Some checks failed
Windows project source guards / test (push) Has been cancelled
Owner request 2026-11-26 ("so everything works with Hysteria, AWG and the rest"). The helpers that dial with
their own UDP socket talk to a loopback `direct` UDP inbound of sing-box (override address = the real server) whose
rule leads into the WARP hop: the AmneziaWG helper in both modes (peer 127.0.0.1:relay, new `unbound` mode without the
physical-interface binding, IPv4 tunnel with an inner MTU of 1250, started after the front), the main Hysteria2
helper in the proxy mode (server name kept in the TLS SNI). Slot helpers stay TUN-only. Verified on win10 with the
real components: the real AmneziaWG server brings a real page through the hop in the proxy mode and under the TUN;
Go tests of the helper pass as a Windows exe. Hysteria2 through the relay is unit-tested on real nodes but not live:
the test person's Hysteria2 servers do not answer from the VM with or without the hop.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
// Entering through the WARP hop (owner decision 2026-11-25): the helper's UDP socket must stay on the default route,
|
|
// which is the TUN, so that the router sends this process into the hop. Binding it to the physical interface would
|
|
// bypass the hop and show the server's address to the provider.
|
|
func TestUnboundBindDoesNotBindToThePhysicalInterface(t *testing.T) {
|
|
c := testConfig()
|
|
c.Unbound = true
|
|
bind := newProtectedBind(c, nil)
|
|
protected := false
|
|
bind.protect = func(*protectedBind) error { protected = true; return nil }
|
|
if _, _, err := bind.Open(0); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer bind.Close()
|
|
if protected {
|
|
t.Fatal("an unbound socket was bound to the physical interface")
|
|
}
|
|
}
|
|
|
|
func TestBoundBindStillBindsToThePhysicalInterface(t *testing.T) {
|
|
bind := newProtectedBind(testConfig(), nil)
|
|
protected := false
|
|
bind.protect = func(*protectedBind) error { protected = true; return nil }
|
|
if _, _, err := bind.Open(0); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer bind.Close()
|
|
if !protected {
|
|
t.Fatal("the default mode must bind to the physical interface")
|
|
}
|
|
}
|
|
|
|
func TestUnboundNeedsPeerAddressesNotNames(t *testing.T) {
|
|
c := testConfig()
|
|
c.Unbound = true
|
|
c.Endpoint.Peers[0].Address = "server.example"
|
|
if err := bootstrapPeers(&c); err == nil {
|
|
t.Fatal("a peer name cannot be resolved without the physical interface")
|
|
}
|
|
}
|