4
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2025-07-06 00:34:08 +00:00

Support multiple TCP listeners

This commit is contained in:
Neil Alexander
2019-03-04 17:52:57 +00:00
parent ae79246a66
commit be8db0c120
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)