Skip to content

Commit e2318fc

Browse files
committed
ipn/wg: re-enable bepass tricks on warp
1 parent 7efb733 commit e2318fc

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

intra/ipn/wg/wgconn.go

+15-17
Original file line numberDiff line numberDiff line change
@@ -395,23 +395,21 @@ func (s *StdNetBind) Send(buf [][]byte, peer conn.Endpoint) (err error) {
395395
return syscall.EAFNOSUPPORT
396396
}
397397

398-
if experimentalWg {
399-
// overwrite the 3 reserved bytes on non-random packets
400-
if overwriteReserved {
401-
if len(data) > 3 && isWgMsgType(data[0]) {
402-
// from: github.com/bepass-org/warp-plus/blob/19ac233cc6/wireguard/device/peer.go#L138
403-
copy(data[1:4], s.reserved)
404-
overwritten = true
405-
}
406-
if !flooded && !overwritten {
407-
if len(data) == device.MessageInitiationSize {
408-
go s.flood(uc, dst, fkHandshake) // probably a handshake
409-
flooded = true
410-
} else if len(data) == device.MessageKeepaliveSize {
411-
go s.flood(uc, dst, fkKeepalive) // probably a keepalive
412-
flooded = true
413-
}
414-
}
398+
// overwrite the 3 reserved bytes on non-random packets
399+
if overwriteReserved {
400+
if len(data) > 3 && isWgMsgType(data[0]) {
401+
// from: github.com/bepass-org/warp-plus/blob/19ac233cc6/wireguard/device/peer.go#L138
402+
copy(data[1:4], s.reserved)
403+
overwritten = true
404+
}
405+
}
406+
if !flooded && !overwritten && (experimentalWg || overwriteReserved) {
407+
if len(data) == device.MessageInitiationSize {
408+
go s.flood(uc, dst, fkHandshake) // probably a handshake
409+
flooded = true
410+
} else if len(data) == device.MessageKeepaliveSize {
411+
go s.flood(uc, dst, fkKeepalive) // probably a keepalive
412+
flooded = true
415413
}
416414
}
417415

intra/ipn/wgproxy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ func wgIfConfigOf(id string, txtptr *string) (ifaddrs []netip.Prefix, allowedadd
431431
case "endpoint": // may exist more than once
432432
// TODO: endpoint could be v4 or v6 or a hostname
433433
n := 0
434-
if isRPN(id) && settings.ExperimentalWireGuard.Load() {
434+
if isRPN(id) {
435435
v4, v6, err := warp.Endpoints()
436436
if err == nil {
437437
warpipcsv := v4.String() + "," + v6.String()

0 commit comments

Comments
 (0)