WIP moving IP-specific checks from tuntap to core

This commit is contained in:
Arceliar 2021-06-13 04:22:21 -05:00
parent bb66851c2b
commit 1147ee1934
9 changed files with 339 additions and 220 deletions

View file

@ -20,8 +20,6 @@ import (
//"github.com/Arceliar/phony" // TODO? use instead of mutexes
)
type keyArray [ed25519.PublicKeySize]byte
type links struct {
core *Core
mutex sync.RWMutex // protects links below
@ -231,7 +229,7 @@ func (intf *link) handler() (chan struct{}, error) {
intf.links.core.log.Infof("Connected %s: %s, source %s",
strings.ToUpper(intf.info.linkType), themString, intf.info.local)
// Run the handler
err = intf.links.core.PacketConn.HandleConn(ed25519.PublicKey(intf.info.key[:]), intf.conn)
err = intf.links.core.pc.HandleConn(ed25519.PublicKey(intf.info.key[:]), intf.conn)
// TODO don't report an error if it's just a 'use of closed network connection'
if err != nil {
intf.links.core.log.Infof("Disconnected %s: %s, source %s; error: %s",