mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-08-03 04:15:15 +03:00
Add ping support for WireGuard endpoint
This commit is contained in:
20
transport/wireguard/device_nat_non_gvisor.go
Normal file
20
transport/wireguard/device_nat_non_gvisor.go
Normal file
@@ -0,0 +1,20 @@
|
||||
//go:build !with_gvisor
|
||||
|
||||
package wireguard
|
||||
|
||||
type gVisorOutbound struct{}
|
||||
|
||||
func newGVisorOutbound() gVisorOutbound {
|
||||
return gVisorOutbound{}
|
||||
}
|
||||
|
||||
func (d *natDeviceWrapper) Read(bufs [][]byte, sizes []int, offset int) (n int, err error) {
|
||||
select {
|
||||
case packet := <-d.packetOutbound:
|
||||
defer packet.Release()
|
||||
sizes[0] = copy(bufs[0][offset:], packet.Bytes())
|
||||
return 1, nil
|
||||
default:
|
||||
}
|
||||
return d.Device.Read(bufs, sizes, offset)
|
||||
}
|
||||
Reference in New Issue
Block a user