integration
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Constants
- Variables
- func ExecBackground(t *testing.T, processName string, netNS *os.File, name string, args []string) (<-chan error, func() error)
- func TestBigUDP(t *testing.T, logger slog.Logger, _ *url.URL, conn *tailnet.Conn, ...)
- func TestSuite(t *testing.T, _ slog.Logger, serverURL *url.URL, conn *tailnet.Conn, ...)
- type BasicClientStarter
- type Client
- type ClientNumber
- type ClientStarter
- type NGINXServerOptions
- type NetworkService
- type NetworkingLoopback
- type NetworkingNAT
- type NetworkingProvider
- type ServerStarter
- type SimpleServerOptions
- type TestNetworking
- type TestNetworkingClient
- type TestNetworkingProcess
- type TestNetworkingSTUN
- type TestNetworkingServer
- type TestTopology
- type TriangleNetwork
- type UDPEchoService
Constants¶
const EchoPort = 2381
Variables¶
var Client1 =Client{Number:ClientNumber1,ID:uuid.MustParse("00000000-0000-0000-0000-000000000001"),ListenPort: client1Port,ShouldRunTests:true,TunnelSrc:true,}
var Client2 =Client{Number:ClientNumber2,ID:uuid.MustParse("00000000-0000-0000-0000-000000000002"),ListenPort: client2Port,ShouldRunTests:false,TunnelSrc:false,}
Functions¶
funcExecBackground¶added inv2.12.0
func ExecBackground(t *testing.T, processNamestring, netNS *os.File, namestring, args []string) (<-chanerror, func()error)
ExecBackground starts a subprocess with the given flags and returns achannel that will receive the error when the subprocess exits. The returnedfunction can be used to close the subprocess.
processName is used to identify the subprocess in logs.
Optionally, a network namespace can be passed to run the subprocess in.
Do not call close then wait on the channel. Use the returned value from thefunction instead in this case.
Cleanup is handled automatically if you don't care about monitoring theprocess manually.
funcTestBigUDP¶added inv2.24.0
Types¶
typeBasicClientStarter¶added inv2.24.0
type BasicClientStarter struct {BlockEndpointsboolDERPForceWebsocketsbool// WaitForConnection means wait for (any) peer connection before returning from StartClientWaitForConnectionbool// WaitForConnection means wait for a direct peer connection before returning from StartClientWaitForDirectbool// Service is a network service (e.g. an echo server) to start on the client. If Wait* is set, the service is// started prior to waiting.ServiceNetworkServiceLogPacketsbool}
typeClientNumber¶added inv2.12.0
type ClientNumberint
const (ClientNumber1ClientNumber = 1ClientNumber2ClientNumber = 2)
typeClientStarter¶added inv2.12.0
typeNGINXServerOptions¶added inv2.12.0
type NGINXServerOptions struct {SimpleServerOptions}
func (NGINXServerOptions)StartServer¶added inv2.12.0
typeNetworkService¶added inv2.24.0
typeNetworkingLoopback¶added inv2.24.0
type NetworkingLoopback struct{}
NetworkingLoopback creates a network namespace with a loopback interfacefor all tests to share. This is the simplest networking setup. The networknamespace only exists for isolation on the host and doesn't serve any routingpurpose.
func (NetworkingLoopback)SetupNetworking¶added inv2.24.0
func (NetworkingLoopback) SetupNetworking(t *testing.T, _slog.Logger)TestNetworking
typeNetworkingNAT¶added inv2.24.0
NetworkingNAT creates a fake internet and sets up "NAT"forwarding rules, either easy or hard.See createFakeInternet.NAT is achieved through a single iptables masquerade rule.
func (NetworkingNAT)SetupNetworking¶added inv2.24.0
func (nNetworkingNAT) SetupNetworking(t *testing.T, lslog.Logger)TestNetworking
SetupNetworking creates a fake internet with multiple STUN servers and sets upNAT forwarding rules. Client NATs are controlled by the switches ClientXHard, which if true, sets up hardnat.
typeNetworkingProvider¶added inv2.24.0
type NetworkingProvider interface {// SetupNetworking creates interfaces and network namespaces for the test.// The most simple implementation is NetworkSetupDefault, which only creates// a network namespace shared for all tests.SetupNetworking(t *testing.T, loggerslog.Logger)TestNetworking}
typeServerStarter¶added inv2.12.0
typeSimpleServerOptions¶added inv2.12.0
type SimpleServerOptions struct {// FailUpgradeDERP will make the DERP server fail to handle the initial DERP// upgrade in a way that causes the client to fallback to// DERP-over-WebSocket fallback automatically.// Incompatible with DERPWebsocketOnly.FailUpgradeDERPbool// DERPWebsocketOnly will make the DERP server only accept WebSocket// connections. If a DERP request is received that is not using WebSocket// fallback, the test will fail.// Incompatible with FailUpgradeDERP.DERPWebsocketOnlybool}
func (SimpleServerOptions)Router¶added inv2.12.0
func (oSimpleServerOptions) Router(t *testing.T, loggerslog.Logger) *chi.Mux
func (SimpleServerOptions)StartServer¶added inv2.12.0
typeTestNetworking¶
type TestNetworking struct {ServerTestNetworkingServerSTUNs []TestNetworkingSTUNClient1TestNetworkingClientClient2TestNetworkingClient}
typeTestNetworkingClient¶added inv2.12.0
type TestNetworkingClient struct {ProcessTestNetworkingProcess// ServerAccessURL is the hostname and port that the client uses to access// the server over HTTP for coordination.ServerAccessURLstring// DERPMap is the DERP map that the client uses. If nil, a basic DERP map// containing only a single DERP with `ServerAccessURL` is used with no// STUN servers.DERPMap *tailcfg.DERPMap}
func (TestNetworkingClient)ResolveDERPMap¶added inv2.12.0
func (cTestNetworkingClient) ResolveDERPMap() (*tailcfg.DERPMap,error)
typeTestNetworkingProcess¶
type TestNetworkingProcess struct {// NetNS to enter. If nil, the current network namespace is used.NetNS *os.File}
func (TestNetworkingProcess)CapturePackets¶added inv2.24.0
func (pTestNetworkingProcess) CapturePackets(t *testing.T, name, dirstring)
typeTestNetworkingSTUN¶added inv2.12.0
type TestNetworkingSTUN struct {ProcessTestNetworkingProcessIPstringListenAddrstring}
typeTestNetworkingServer¶added inv2.12.0
type TestNetworkingServer struct {ProcessTestNetworkingProcessListenAddrstring}
typeTestTopology¶
type TestTopology struct {NamestringNetworkingProviderNetworkingProvider// Server is the server starter for the test. It is executed in the server// subprocess.ServerServerStarter// ClientStarter.StartClient gets called in each client subprocess. It's expected to// create the tailnet.Conn and ensure connectivity to it's peer.ClientStarterClientStarter// RunTests is the main test function. It's called in each of the client// subprocesses. If tests can only run once, they should check the client ID// and return early if it's not the expected one.RunTests func(t *testing.T, loggerslog.Logger, serverURL *url.URL, conn *tailnet.Conn, meClient, peerClient)}
typeTriangleNetwork¶added inv2.24.0
type TriangleNetwork struct {Client1MTUint}
func (TriangleNetwork)SetupNetworking¶added inv2.24.0
func (nTriangleNetwork) SetupNetworking(t *testing.T, lslog.Logger)TestNetworking
SetupNetworking creates multiple namespaces with a central router in the following topology.. ┌──────────────┐. │ │. │ Server ├─────────────────────────────────────┐. │ │fdac:38fa:ffff:3::2 │. └──────────────┘ │ fdac:38fa:ffff:3::1. ┌──────────────┐ ┌─────┴───────┐. │ │ fdac:38fa:ffff:1::1│ │. │ Client 1 ├───────────────────────────────┤ Router │. │ │fdac:38fa:ffff:1::2 │ │. └──────────────┘ └─────┬───────┘. ┌──────────────┐ │ fdac:38fa:ffff:2::1. │ │ │. │ Client 2 ├─────────────────────────────────────┘. │ │fdac:38fa:ffff:2::2. └──────────────┘The veth link between Client 1 and the router has a configurable MTU via Client1MTU.
typeUDPEchoService¶added inv2.24.0
type UDPEchoService struct{}