Documentation ¶
Overview ¶
Package tsdial provides a Dialer type that can dial out of tailscaled.
Index ¶
- type Dialer
- func (d *Dialer) Close() error
- func (d *Dialer) PeerAPIHTTPClient() *http.Client
- func (d *Dialer) PeerAPITransport() *http.Transport
- func (d *Dialer) PeerDialControlFunc() func(network, address string, c syscall.RawConn) error
- func (d *Dialer) SetExitDNSDoH(doh string)
- func (d *Dialer) SetNetMap(nm *netmap.NetworkMap)
- func (d *Dialer) SetNetMon(netMon *netmon.Monitor)
- func (d *Dialer) SetTUNName(name string)
- func (d *Dialer) SystemDial(ctx context.Context, network, addr string) (net.Conn, error)
- func (d *Dialer) TUNName() string
- func (d *Dialer) UserDial(ctx context.Context, network, addr string) (net.Conn, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dialer ¶
type Dialer struct { Logf logger.Logf // UseNetstackForIP if non-nil is whether NetstackDialTCP (if // it's non-nil) should be used to dial the provided IP. UseNetstackForIP func(netip.Addr) bool // NetstackDialTCP dials the provided IPPort using netstack. // If nil, it's not used. NetstackDialTCP func(context.Context, netip.AddrPort) (net.Conn, error) // contains filtered or unexported fields }
Dialer dials out of tailscaled, while taking care of details while handling the dozens of edge cases depending on the server mode (TUN, netstack), the OS network sandboxing style (macOS/iOS Extension, none), user-selected route acceptance prefs, etc.
func (*Dialer) PeerAPIHTTPClient ¶
PeerAPIHTTPClient returns an HTTP Client to call peers' peerapi endpoints. // The returned Client must not be mutated; it's owned by the Dialer and shared by callers.
func (*Dialer) PeerAPITransport ¶
PeerAPITransport returns a Transport to call peers' peerapi endpoints.
The returned value must not be mutated; it's owned by the Dialer and shared by callers.
func (*Dialer) PeerDialControlFunc ¶
PeerDialControlFunc returns a function that can assigned to net.Dialer.Control to set sockopts or whatnot to make a dial escape the current platform's network sandbox.
On many platforms the returned func will be nil.
Notably, this is non-nil on iOS and macOS when run as a Network or System Extension (the GUI variants).
func (*Dialer) SetExitDNSDoH ¶
SetExitDNSDoH sets (or clears) the exit node DNS DoH server base URL to use. The doh URL should contain the scheme, authority, and path, but without a '?' and/or query parameters.
For example, "http://100.68.82.120:47830/dns-query".
func (*Dialer) SetNetMap ¶
func (d *Dialer) SetNetMap(nm *netmap.NetworkMap)
SetNetMap sets the current network map and notably, the DNS names in its DNS configuration.
func (*Dialer) SetTUNName ¶
SetTUNName sets the name of the tun device in use ("tailscale0", "utun6", etc). This is needed on some platforms to set sockopts to bind to the same interface index.
func (*Dialer) SystemDial ¶ added in v1.24.1
SystemDial connects to the provided network address without going over Tailscale. It prefers going over the default interface and closes existing connections if the default interface changes. It is used to connect to Control and (in the future, as of 2022-04-27) DERPs..