1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-28 14:50:26 +08:00

init complete

This commit is contained in:
fumiama
2021-10-25 01:01:22 +08:00
parent d9138df3cd
commit e29d5b2f48
9 changed files with 115 additions and 38 deletions

View File

@@ -16,9 +16,17 @@ type Link struct {
pipe chan *head.Packet
peerip net.IP
endpoint *net.UDPAddr
allowedips []*net.IPNet
hasKeepRuning bool
status int
}
const (
LINK_STATUS_DOWN = iota
LINK_STATUS_HALFUP
LINK_STATUS_UP
)
var (
connections = make(map[string]*Link)
connmapmu sync.RWMutex
@@ -38,6 +46,7 @@ func (l *Link) Close() {
connmapmu.Lock()
delete(connections, l.peerip.String())
connmapmu.Unlock()
l.status = LINK_STATUS_DOWN
}
func (l *Link) Read() *head.Packet {