Support multiple TCP listeners

This commit is contained in:
Neil Alexander 2019-03-04 17:52:57 +00:00
parent ae79246a66
commit be8db0c120
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
6 changed files with 110 additions and 74 deletions

View file

@ -21,8 +21,9 @@ type link struct {
core *Core
mutex sync.RWMutex // protects interfaces below
interfaces map[linkInfo]*linkInterface
awdl awdl // AWDL interface support
tcp tcpInterface // TCP interface support
handlers map[string]linkListener
awdl awdl // AWDL interface support
tcp tcp // TCP interface support
// TODO timeout (to remove from switch), read from config.ReadTimeout
}
@ -34,6 +35,10 @@ type linkInfo struct {
remote string // Remote name or address
}
type linkListener interface {
init(*link) error
}
type linkInterfaceMsgIO interface {
readMsg() ([]byte, error)
writeMsg([]byte) (int, error)