Movatterモバイル変換


[0]ホーム

URL:


tsdial

package
v1.92.3Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2025 License:BSD-3-ClauseImports:33Imported by:50

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package tsdial provides a Dialer type that can dial out of tailscaled.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeDialer

type Dialer struct {Logflogger.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)// NetstackDialUDP dials the provided IPPort using netstack.// If nil, it's not used.NetstackDialUDP func(context.Context,netip.AddrPort) (net.Conn,error)// contains filtered or unexported fields}

Dialer dials out of tailscaled, while taking care of details whilehandling the dozens of edge cases depending on the server mode(TUN, netstack), the OS network sandboxing style (macOS/iOSExtension, none), user-selected route acceptance prefs, etc.

Before use, SetNetMon should be called with a netmon.Monitor.

funcNewDialeradded inv1.66.0

func NewDialer(netMon *netmon.Monitor) *Dialer

NewDialer returns a new Dialer that can dial out of tailscaled.Its exported fields should be set before use, if any.

funcNewFromFuncForDebugadded inv1.90.0

func NewFromFuncForDebug(logflogger.Logf, dialnetx.DialFunc) *Dialer

NewFromFuncForDebug is like NewDialer but takes a netx.DialFuncand no netMon. It's meant exclusively for the "tailscale debug ts2021"debug command, and perhaps tests.

func (*Dialer)Closeadded inv1.24.1

func (d *Dialer) Close()error

func (*Dialer)NetMonadded inv1.66.0

func (d *Dialer) NetMon() *netmon.Monitor

NetMon returns the Dialer's network monitor.It returns nil if SetNetMon has not been called.

func (*Dialer)PeerAPIHTTPClient

func (d *Dialer) PeerAPIHTTPClient() *http.Client

PeerAPIHTTPClient returns an HTTP Client to call peers' peerapiendpoints. //The returned Client must not be mutated; it's owned by the Dialerand shared by callers.

func (*Dialer)PeerAPITransport

func (d *Dialer) PeerAPITransport() *http.Transport

PeerAPITransport returns a Transport to call peers' peerapiendpoints.

The returned value must not be mutated; it's owned by the Dialerand shared by callers.

func (*Dialer)PeerDialControlFunc

func (d *Dialer) PeerDialControlFunc() func(network, addressstring, csyscall.RawConn)error

PeerDialControlFunc returns a functionthat can assigned to net.Dialer.Control to set sockopts or whatnotto 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 orSystem Extension (the GUI variants).

func (*Dialer)SetBusadded inv1.90.0

func (d *Dialer) SetBus(bus *eventbus.Bus)

func (*Dialer)SetExitDNSDoH

func (d *Dialer) SetExitDNSDoH(dohstring)

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 withouta '?' 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 namesin its DNS configuration.

func (*Dialer)SetNetMonadded inv1.40.0

func (d *Dialer) SetNetMon(netMon *netmon.Monitor)

SetNetMon sets d's network monitor to netMon.It is a no-op to call SetNetMon with the same netMon as the current one.

func (*Dialer)SetRoutesadded inv1.66.0

func (d *Dialer) SetRoutes(routes, localRoutes []netip.Prefix)

SetRoutes configures the dialer to dial the specified routes via Tailscale,and the specified localRoutes using the default interface.

func (*Dialer)SetSystemDialerForTestadded inv1.84.0

func (d *Dialer) SetSystemDialerForTest(fnnetx.DialFunc)

SetSystemDialerForTest sets an alternate function to use for SystemDialinstead of netns.Dialer. This is intended for use with nettest.MemoryNetwork.

func (*Dialer)SetTUNName

func (d *Dialer) SetTUNName(namestring)

SetTUNName sets the name of the tun device in use ("tailscale0", "utun6",etc). This is needed on some platforms to set sockopts to bindto the same interface index.

func (*Dialer)SystemDialadded inv1.24.1

func (d *Dialer) SystemDial(ctxcontext.Context, network, addrstring) (net.Conn,error)

SystemDial connects to the provided network address without going overTailscale. It prefers going over the default interface and closes existingconnections if the default interface changes. It is used to connect toControl and (in the future, as of 2022-04-27) DERPs..

func (*Dialer)TUNName

func (d *Dialer) TUNName()string

TUNName returns the name of the tun device in use, if any.Example format ("tailscale0", "utun6").

func (*Dialer)UserDial

func (d *Dialer) UserDial(ctxcontext.Context, network, addrstring) (net.Conn,error)

UserDial connects to the provided network address as if a user wereinitiating the dial. (e.g. from a SOCKS or HTTP outbound proxy)

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp