mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 19:29:57 +00:00
TUN-6531: Implement ICMP proxy for Windows using IcmpSendEcho
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
const (
|
||||
defaultCloseAfterIdle = time.Second * 15
|
||||
mtu = 1500
|
||||
icmpTimeoutMs = 1000
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -42,3 +43,11 @@ func newICMPConn(listenIP netip.Addr) (*icmp.PacketConn, error) {
|
||||
}
|
||||
return icmp.ListenPacket(network, listenIP.String())
|
||||
}
|
||||
|
||||
func getICMPEcho(pk *packet.ICMP) (*icmp.Echo, error) {
|
||||
echo, ok := pk.Message.Body.(*icmp.Echo)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expect ICMP echo, got %s", pk.Type)
|
||||
}
|
||||
return echo, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user