summaryrefslogtreecommitdiffhomepage
path: root/src/routing.go
blob: 99b180c42399555b64587262f0f14ffda4d6f26a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"sync"
)

/* Thread-safe high level functions for cryptkey routing.
 *
 */

type RoutingTable struct {
	IPv4  *Trie
	IPv6  *Trie
	mutex sync.RWMutex
}

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)
}