TUN-6716: Document limitation of Windows ICMP proxy

This commit is contained in:
cthuang 2022-09-28 19:02:46 +01:00
parent 870193c064
commit cbf8c71fab
2 changed files with 4 additions and 1 deletions

View File

@ -262,6 +262,9 @@ func (ip *icmpProxy) Serve(ctx context.Context) error {
return ctx.Err() return ctx.Err()
} }
// Request sends an ICMP echo request and wait for a reply or timeout.
// The async version of Win32 APIs take a callback whose memory is not garbage collected, so we use the synchronous version.
// It's possible that a slow request will block other requests, so we set the timeout to only 1s.
func (ip *icmpProxy) Request(pk *packet.ICMP, responder packet.FunnelUniPipe) error { func (ip *icmpProxy) Request(pk *packet.ICMP, responder packet.FunnelUniPipe) error {
if pk == nil { if pk == nil {
return errPacketNil return errPacketNil

View File

@ -11,7 +11,7 @@ import (
type ICMPRouter interface { type ICMPRouter interface {
// Serve starts listening for responses to the requests until context is done // Serve starts listening for responses to the requests until context is done
Serve(ctx context.Context) error Serve(ctx context.Context) error
// Request sends an ICMP message // Request sends an ICMP message. Implementations should not modify pk after the function returns.
Request(pk *ICMP, responder FunnelUniPipe) error Request(pk *ICMP, responder FunnelUniPipe) error
} }