mirror of
https://github.com/amnezia-vpn/amnezia-tun2socks.git
synced 2026-05-17 08:15:46 +03:00
26 lines
492 B
Go
26 lines
492 B
Go
package core
|
|
|
|
import (
|
|
"gvisor.dev/gvisor/pkg/tcpip"
|
|
"gvisor.dev/gvisor/pkg/tcpip/header"
|
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
|
|
|
"github.com/amnezia-vpn/amnezia-tun2socks/v2/core/option"
|
|
)
|
|
|
|
func withRouteTable(nicID tcpip.NICID) option.Option {
|
|
return func(s *stack.Stack) error {
|
|
s.SetRouteTable([]tcpip.Route{
|
|
{
|
|
Destination: header.IPv4EmptySubnet,
|
|
NIC: nicID,
|
|
},
|
|
{
|
|
Destination: header.IPv6EmptySubnet,
|
|
NIC: nicID,
|
|
},
|
|
})
|
|
return nil
|
|
}
|
|
}
|