Work on UAPI
Cross-platform API (get operation) Handshake initiation creation process Outbound packet flow Fixes from code-review
This commit is contained in:
parent
8236f3afa2
commit
1f0976a26c
18 changed files with 707 additions and 243 deletions
|
|
@ -12,9 +12,20 @@ type RoutingTable struct {
|
|||
mutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (table *RoutingTable) AllowedIPs(peer *Peer) []net.IPNet {
|
||||
table.mutex.RLock()
|
||||
defer table.mutex.RUnlock()
|
||||
|
||||
allowed := make([]net.IPNet, 10)
|
||||
table.IPv4.AllowedIPs(peer, allowed)
|
||||
table.IPv6.AllowedIPs(peer, allowed)
|
||||
return allowed
|
||||
}
|
||||
|
||||
func (table *RoutingTable) Reset() {
|
||||
table.mutex.Lock()
|
||||
defer table.mutex.Unlock()
|
||||
|
||||
table.IPv4 = nil
|
||||
table.IPv6 = nil
|
||||
}
|
||||
|
|
@ -22,6 +33,7 @@ func (table *RoutingTable) Reset() {
|
|||
func (table *RoutingTable) RemovePeer(peer *Peer) {
|
||||
table.mutex.Lock()
|
||||
defer table.mutex.Unlock()
|
||||
|
||||
table.IPv4 = table.IPv4.RemovePeer(peer)
|
||||
table.IPv6 = table.IPv6.RemovePeer(peer)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue