mirror of
https://github.com/fosrl/newt.git
synced 2026-02-08 05:56:40 +00:00
Icmp2
This commit is contained in:
@@ -56,15 +56,17 @@ type Net netTun
|
||||
|
||||
// NetTunOptions contains options for creating a NetTUN device
|
||||
type NetTunOptions struct {
|
||||
EnableTCPProxy bool
|
||||
EnableUDPProxy bool
|
||||
EnableTCPProxy bool
|
||||
EnableUDPProxy bool
|
||||
EnableICMPProxy bool
|
||||
}
|
||||
|
||||
// CreateNetTUN creates a new TUN device with netstack without proxying
|
||||
func CreateNetTUN(localAddresses, dnsServers []netip.Addr, mtu int) (tun.Device, *Net, error) {
|
||||
return CreateNetTUNWithOptions(localAddresses, dnsServers, mtu, NetTunOptions{
|
||||
EnableTCPProxy: true,
|
||||
EnableUDPProxy: true,
|
||||
EnableTCPProxy: true,
|
||||
EnableUDPProxy: true,
|
||||
EnableICMPProxy: true,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -84,13 +86,14 @@ func CreateNetTUNWithOptions(localAddresses, dnsServers []netip.Addr, mtu int, o
|
||||
mtu: mtu,
|
||||
}
|
||||
|
||||
// Initialize proxy handler if TCP or UDP proxying is enabled
|
||||
if options.EnableTCPProxy || options.EnableUDPProxy {
|
||||
// Initialize proxy handler if TCP, UDP, or ICMP proxying is enabled
|
||||
if options.EnableTCPProxy || options.EnableUDPProxy || options.EnableICMPProxy {
|
||||
var err error
|
||||
dev.proxyHandler, err = NewProxyHandler(ProxyHandlerOptions{
|
||||
EnableTCP: options.EnableTCPProxy,
|
||||
EnableUDP: options.EnableUDPProxy,
|
||||
MTU: mtu,
|
||||
EnableTCP: options.EnableTCPProxy,
|
||||
EnableUDP: options.EnableUDPProxy,
|
||||
EnableICMP: options.EnableICMPProxy,
|
||||
MTU: mtu,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to create proxy handler: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user