Files
OpenFlux/netbind/netbind_test.go
p1neappleXpressandClaude Opus 4.8 38867720ac integrate: fold openfluxfork features onto the encrypted-logging hotfix
Base is hotfix/oflx-encrypted-logging-context; in every place both trees
touched the same code, the hotfix version wins (3-level logger, heard-first
routing + MarkStalled, replay window, boards JSON API, robust SOCKS5 auth).

Brought over from meepo161/openfluxfork@fork-main (the mobile/ Android bridge
is intentionally left in the Android fork):
- provision/ + node_wizard.go + --node-wizard: SSH VDS exit-node install.
- deploy/node-install.sh + .github/workflows/node-release.yml: pinned,
  hash-verified node release.
- netbind/ + tun_windows.go + --inbound=tun on Windows (Wintun): full tunnel
  with the core's own sockets bound to the real interface; dial sites in
  direct/boards/vyandex/cupsonline/mailru/yandex now dial bound.
- transport/yandex/cookies.go + --yandex-cookies-file: Netscape cookie import
  into the shared vyandex jar (sessions and single-transport alike).
- yandex: CheckVolgaDocument (doc suitability for the wizard) and the PoW
  captcha fix (a rejected challenge is a captcha, not a bad document).
- --http-proxy: HTTP CONNECT proxy over the same tunnel as SOCKS5.
- ipcStatusLoop: per-second IPC Status frame with the active carrier
  (Session.LiveTransports / ActiveTransport).

Builds for darwin, windows and linux; go vet and the full test suite pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-27 02:47:49 +03:00

58 lines
1.1 KiB
Go

package netbind
import (
"errors"
"net"
"syscall"
"testing"
"time"
)
func TestWrapKeepsOwnControlAndFollowsBinding(t *testing.T) {
defer current.Store(nil)
var calls []string
d := Wrap(&net.Dialer{Timeout: time.Second, Control: func(string, string, syscall.RawConn) error {
calls = append(calls, "own")
return nil
}})
ln, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Fatal(err)
}
defer ln.Close()
go func() {
for {
c, err := ln.Accept()
if err != nil {
return
}
c.Close()
}
}()
// Unbound: only the dialer's own Control runs.
c, err := d.Dial("tcp", ln.Addr().String())
if err != nil {
t.Fatal(err)
}
c.Close()
if len(calls) != 1 {
t.Fatalf("calls %v", calls)
}
// Bound: the binding runs after it, and its error fails the dial.
install(func(string, string, syscall.RawConn) error {
calls = append(calls, "bind")
return errors.New("refused")
})
if !Bound() {
t.Fatal("not bound")
}
if _, err := d.Dial("tcp", ln.Addr().String()); err == nil {
t.Fatal("dial should fail through the binding")
}
if len(calls) != 3 || calls[1] != "own" || calls[2] != "bind" {
t.Fatalf("calls %v", calls)
}
}