mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-05 16:56:54 +08:00
25 lines
468 B
Go
Executable File
25 lines
468 B
Go
Executable File
package stack
|
|
|
|
import (
|
|
"gvisor.dev/gvisor/pkg/tcpip"
|
|
"gvisor.dev/gvisor/pkg/tcpip/header"
|
|
)
|
|
|
|
func withICMPHandler() Option {
|
|
return func(s *Stack) error {
|
|
// Add default route table for IPv4 and IPv6.
|
|
// This will handle all incoming ICMP packets.
|
|
s.SetRouteTable([]tcpip.Route{
|
|
{
|
|
Destination: header.IPv4EmptySubnet,
|
|
NIC: s.nicID,
|
|
},
|
|
{
|
|
Destination: header.IPv6EmptySubnet,
|
|
NIC: s.nicID,
|
|
},
|
|
})
|
|
return nil
|
|
}
|
|
}
|