add ability to filter routes based on headers

This commit is contained in:
Asim Aslam
2019-10-31 22:34:06 +00:00
parent 967d7ecda7
commit 174fbde049
2 changed files with 80 additions and 20 deletions

View File

@@ -79,21 +79,6 @@ func newNetwork(opts ...Option) Network {
o(&options)
}
// init tunnel address to the network bind address
options.Tunnel.Init(
tunnel.Address(options.Address),
)
// init router Id to the network id
options.Router.Init(
router.Id(options.Id),
)
// create tunnel client with tunnel transport
tunTransport := tun.NewTransport(
tun.WithTunnel(options.Tunnel),
)
// set the address to a hashed address
hasher := fnv.New64()
hasher.Write([]byte(options.Address + options.Id))
@@ -111,6 +96,22 @@ func newNetwork(opts ...Option) Network {
peerAddress = address
}
// init tunnel address to the network bind address
options.Tunnel.Init(
tunnel.Address(options.Address),
)
// init router Id to the network id
options.Router.Init(
router.Id(options.Id),
router.Address(peerAddress),
)
// create tunnel client with tunnel transport
tunTransport := tun.NewTransport(
tun.WithTunnel(options.Tunnel),
)
// server is network server
server := server.NewServer(
server.Id(options.Id),