|
@@ -20,7 +20,7 @@ import (
|
|
|
type tun struct {
|
|
|
io.ReadWriteCloser
|
|
|
cidr *net.IPNet
|
|
|
- routeTree *cidr.Tree4
|
|
|
+ routeTree *cidr.Tree4[iputil.VpnIp]
|
|
|
}
|
|
|
|
|
|
func newTun(_ *logrus.Logger, _ string, _ *net.IPNet, _ int, _ []Route, _ int, _ bool, _ bool) (*tun, error) {
|
|
@@ -46,12 +46,8 @@ func (t *tun) Activate() error {
|
|
|
}
|
|
|
|
|
|
func (t *tun) RouteFor(ip iputil.VpnIp) iputil.VpnIp {
|
|
|
- r := t.routeTree.MostSpecificContains(ip)
|
|
|
- if r != nil {
|
|
|
- return r.(iputil.VpnIp)
|
|
|
- }
|
|
|
-
|
|
|
- return 0
|
|
|
+ _, r := t.routeTree.MostSpecificContains(ip)
|
|
|
+ return r
|
|
|
}
|
|
|
|
|
|
// The following is hoisted up from water, we do this so we can inject our own fd on iOS
|