Documentation ¶
Index ¶
- Variables
- func IsIPv6(addr string) bool
- func PathToSocket() string
- type Client
- func (c *Client) Dialer(ctx context.Context, slug string) (d Dialer, err error)
- func (c *Client) Establish(ctx context.Context, slug string) (res *EstablishResponse, err error)
- func (c *Client) Instances(ctx context.Context, org *api.Organization, app string) (instances Instances, err error)
- func (c *Client) Kill(ctx context.Context) error
- func (c *Client) Ping(ctx context.Context) (res PingResponse, err error)
- func (c *Client) Pinger(ctx context.Context, slug string) (p *Pinger, err error)
- func (c *Client) Probe(ctx context.Context, slug string) error
- func (c *Client) Resolve(ctx context.Context, slug, host string) (addr string, err error)
- func (c *Client) WaitForHost(parent context.Context, slug, host string) (err error)
- func (c *Client) WaitForTunnel(parent context.Context, slug string) (err error)
- type Dialer
- type EstablishResponse
- type Instances
- type PingResponse
- type Pinger
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSuchHost = errors.New("no such host") )
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func Establish ¶ added in v0.0.233
Establish starts the daemon, if necessary, and returns a client to it.
func (*Client) Pinger ¶ added in v0.0.296
Pinger creates a Pinger struct. It does this by first ensuring a WireGuard session exists for the specified org, and then opening an additional connection to the agent, which is upgraded to a Pinger connection by sending the "ping6" command. Call "Close" on a Pinger when you're done pinging things.
func (*Client) WaitForHost ¶ added in v0.0.233
WaitForHost waits for a tunnel to the given host of the given org slug to become available in the next four minutes.
type Dialer ¶
type Dialer interface { State() *wg.WireGuardState Config() *wg.Config DialContext(ctx context.Context, network, addr string) (net.Conn, error) }
TODO: refactor to struct
type EstablishResponse ¶ added in v0.0.240
type EstablishResponse struct { WireGuardState *wg.WireGuardState TunnelConfig *wg.Config }
type PingResponse ¶ added in v0.0.234
type Pinger ¶ added in v0.0.296
type Pinger struct {
// contains filtered or unexported fields
}
Pinger wraps a connection to the flyctl agent over which ICMP requests and replies are written. There's a simple protocol for encapsulating requests and responses; drive it with the Pinger member functions. Pinger implements most of net.PacketConn but is not really intended as such.
func (*Pinger) Err ¶ added in v0.0.296
Err returns any non-recoverable error seen on this Pinger connection; WriteTo and ReadFrom on a Pinger will not function if Err returns non-nil.
func (*Pinger) ReadFrom ¶ added in v0.0.296
ReadFrom reads an ICMP message from a Pinger, using the same protocol as WriteTo. Call `SetReadDeadline` to poll this interface while watching channels or whatever.
func (*Pinger) SetReadDeadline ¶ added in v0.0.296
func (*Pinger) WriteTo ¶ added in v0.0.296
WriteTo writes an ICMP message, including headers, to the specified address. `addr` should always be an IPv6 net.IPAddr beginning with `fdaa` --- you cannot ping random hosts on the Internet with this interface. See golang/x/net/icmp for message construction details; this interface uses gVisor netstack, which is fussy about ICMP, and will only allow icmp.Echo messages with a code of 0.
Pinger runs a trivial protocol to encapsulate ICMP messages over agent connections: each message is a 16-byte IPv6 address, followed by an NBO u16 length, followed by the ICMP message bytes, which again must begin with an ICMP header. Checksums are performed by netstack; don't bother with them.