Documentation
¶
Index ¶
- func FunnelClientIP(r *http.Request) string
- func IsFunneledRequest(r *http.Request) bool
- type NewTSNetServerOpts
- type TSNetServer
- func (t *TSNetServer) Close(_ context.Context) error
- func (t *TSNetServer) ConnContextFn() func(ctx context.Context, c net.Conn) context.Context
- func (t *TSNetServer) Hostname() string
- func (t *TSNetServer) Listen(port int) (net.Listener, error)
- func (t *TSNetServer) ListenFunnel(port int) (net.Listener, error)
- func (t *TSNetServer) LocalClient() (*local.Client, error)
- func (t *TSNetServer) TailscaleIPs() (ip4 string, ip6 string)
- func (t *TSNetServer) WhoIs(r *http.Request) (res TailscaleWhoIs, err error)
- type TailscaleWhoIs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FunnelClientIP ¶
FunnelClientIP returns the IP of the client invoking over Tailscale Funnel. If the request is not coming through a Tailscale Funnel, the result is empty.
func IsFunneledRequest ¶
IsFunneledRequest returns true if the HTTP request is coming over Tailscale Funnel, as opposed to a direct connection.
Types ¶
type NewTSNetServerOpts ¶
type NewTSNetServerOpts struct {
// Hostname for the node
Hostname string
// Auth key
// This is only used on first startup (or if the node key has expired and it needs to be re-authenticated)
// If this is empty, the auth key can also be read from the TS_AUTH_KEY env var or users can use interactive login
AuthKey string
// If true, makes the node ephemeral
Ephemeral bool
// Directory where to store tsnet's state
StateDir string
// Optional store for the IPN state
// Note that even when using a store, tsnet still needs to write data in StateDir
Store ipn.StateStore
// Tags that should be applied to this node in the tailnet, for purposes of ACL enforcement.
// These can be referenced from the ACL policy document.
// Tags are generally required when a node is authenticated using OAuth2.
AdvertiseTags []string
// Enables debug logging
DebugLogging bool
}
NewTSNetServerOpts contains options for NewTSNetServer
type TSNetServer ¶
type TSNetServer struct {
// contains filtered or unexported fields
}
TSNetServer wraps a tsnet.Server for use in the application
func NewTSNetServer ¶
func NewTSNetServer(ctx context.Context, opts NewTSNetServerOpts) (*TSNetServer, error)
NewTSNetServer creates a new TSNetServer instance
func (*TSNetServer) Close ¶
func (t *TSNetServer) Close(_ context.Context) error
Close closes the tsnet server
func (*TSNetServer) ConnContextFn ¶
ConnContextFn returns a function that can be passed to http.Server.Conn
func (*TSNetServer) Hostname ¶
func (t *TSNetServer) Hostname() string
func (*TSNetServer) ListenFunnel ¶
func (t *TSNetServer) ListenFunnel(port int) (net.Listener, error)
func (*TSNetServer) LocalClient ¶
func (t *TSNetServer) LocalClient() (*local.Client, error)
func (*TSNetServer) TailscaleIPs ¶
func (t *TSNetServer) TailscaleIPs() (ip4 string, ip6 string)
func (*TSNetServer) WhoIs ¶
func (t *TSNetServer) WhoIs(r *http.Request) (res TailscaleWhoIs, err error)
WhoIs performs a "whois" request with the LocalClient and returns information about the node WhoIs is only valid for direct tailnet connections For Funnel connections the remote address is the relay, not the real client (use FunnelClientIP instead)
type TailscaleWhoIs ¶
type TailscaleWhoIs struct {
NodeID string `json:"nodeId"`
Name string `json:"name"`
Hostname string `json:"hostname"`
IP4 string `json:"ip4"`
IP6 string `json:"ip6"`
UserLoginName string `json:"userLoginName,omitempty"`
Tags []string `json:"tags,omitempty"`
CapMap tailcfg.PeerCapMap `json:"capMap,omitempty"`
}