Documentation
¶
Overview ¶
Package faketurn provides an in-process TURN server for tests.
Why it is needed: the phase 5 acceptance criterion is "it connects over TURN on symmetric NAT". We cannot imitate symmetric NAT on a single machine, but we can build a situation that produces the SAME RESULT: force the agent to gather relay candidates only (ice.Config.RelayOnly) and point it here. Then the direct path is IMPOSSIBLE, so the tunnel opening is proof that the traffic went over TURN — stronger than a mobile hotspot attempt, where the direct path may have worked as well.
Same pattern as internal/nostr/fakerelay: a test that depends on the real internet is fragile.
Index ¶
Constants ¶
const Realm = "peerpages.test"
Realm is the TURN long-term credential realm.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// User and Pass are the only accepted credentials.
User, Pass string
}
Options are the fake server's settings.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the in-process TURN server.
func StartOn ¶
StartOn starts it on the given port (0 = pick a free one).
Only 127.0.0.1 is listened on: this is a TEST server and must not be exposed to the network.
func (*Server) Allocations ¶
Allocations is how many allocations were granted.
This is the test's real claim: if the tunnel opened AND this counter went up, the traffic really did go over TURN.