server-go/client/connector.go

34 lines
494 B
Go
Raw Normal View History

2018-04-12 01:23:40 +00:00
package client
2018-04-11 09:27:16 +00:00
2018-04-12 01:23:40 +00:00
type Connector interface {
2018-04-11 09:27:16 +00:00
Connect() (readChan <-chan []byte, writeChan chan<- []byte, err error)
Disconnect() error
2018-04-12 01:23:40 +00:00
2018-04-12 05:55:01 +00:00
GetName() string
Clone() Connector
2018-04-12 01:23:40 +00:00
Validate() error
2018-04-11 09:27:16 +00:00
}
2018-04-12 05:55:01 +00:00
type Connectors struct {
Name string `json:"name"`
}
func (c *Connectors) GetName() string {
return c.Name
}
func (c *Connectors) Clone() *Connectors {
return &Connectors{
Name: c.Name,
}
}
func (c *Connectors) Validate() error {
if "" == c.Name {
c.Name = "Connector"
}
return nil
}