Documentation
¶
Index ¶
- Constants
- func StartMetricsServer(c *Core, addr string) error
- func StartWebUI(c *Core, addr string) error
- type AddHandler
- type AddHandlerFunc
- type AllowedPublicKey
- type BlockedPublicKey
- type Core
- func (c *Core) AddPeer(u *url.URL, sintf string) error
- func (c *Core) Address() net.IP
- func (c *Core) CallPeer(u *url.URL, sintf string) error
- func (c *Core) GetPaths() []PathEntryInfo
- func (c *Core) GetPeers() []PeerInfo
- func (c *Core) GetSelf() SelfInfo
- func (c *Core) GetSessions() []SessionInfo
- func (c *Core) GetTree() []TreeEntryInfo
- func (c *Core) Listen(u *url.URL, sintf string) (*Listener, error)
- func (c *Core) ListenLocal(u *url.URL, sintf string) (*Listener, error)
- func (c *Core) MTU() uint64
- func (c *Core) PublicKey() ed25519.PublicKey
- func (c *Core) ReadFrom(p []byte) (n int, from net.Addr, err error)
- func (c *Core) RemovePeer(u *url.URL, sintf string) error
- func (c *Core) RetryPeersNow()
- func (c *Core) SetAdmin(a AddHandler) error
- func (c *Core) SetLogger(log Logger)
- func (c *Core) SetPathNotify(notify func(ed25519.PublicKey))
- func (c *Core) Stop()
- func (c *Core) Subnet() net.IPNet
- func (c *Core) TLSConfig() *tls.Config
- func (c *Core) WriteTo(p []byte, addr net.Addr) (n int, err error)
- type DebugGetPeersRequest
- type DebugGetPeersResponse
- type DebugGetSelfRequest
- type DebugGetSelfResponse
- type DebugGetTreeRequest
- type DebugGetTreeResponse
- type DebugRemoteEnabled
- type GetNodeInfoRequest
- type GetNodeInfoResponse
- type ListenAddress
- type Listener
- type Logger
- type MetricsHandler
- type NodeInfo
- type NodeInfoPrivacy
- type PathEntryInfo
- type Peer
- type PeerFilter
- type PeerInfo
- type SelfInfo
- type SessionInfo
- type SetupOption
- type TreeEntryInfo
- type UIServer
Constants ¶
const ( ProtocolVersionMajor uint16 = 0 ProtocolVersionMinor uint16 = 5 )
const ErrHandshakeHashFailure = handshakeError("invalid hash length")
const ErrHandshakeIncorrectPassword = handshakeError("password does not match remote side")
const ErrHandshakeInvalidKey = handshakeError("invalid public key in handshake")
const ErrHandshakeInvalidLength = handshakeError("invalid handshake length, possible version mismatch")
const ErrHandshakeInvalidPassword = handshakeError("invalid password supplied, check your config")
const ErrHandshakeInvalidPreamble = handshakeError("invalid handshake, remote side sent unexpected preamble (expected meta)")
const ErrLinkAlreadyConfigured = linkError("peer is already configured")
const ErrLinkMaxBackoffInvalid = linkError("max backoff duration invalid")
const ErrLinkNoSuitableIPs = linkError("peer has no suitable addresses")
const ErrLinkNotConfigured = linkError("peer is not configured")
const ErrLinkPasswordInvalid = linkError("invalid password supplied")
const ErrLinkPinnedKeyInvalid = linkError("pinned public key is invalid")
const ErrLinkPriorityInvalid = linkError("priority value is invalid")
const ErrLinkSNINotSupported = linkError("SNI not supported on this link type")
const ErrLinkToSelf = linkError("node cannot connect to self")
const ErrLinkUnrecognisedSchema = linkError("link schema unknown")
Variables ¶
This section is empty.
Functions ¶
func StartMetricsServer ¶ added in v0.0.8
StartMetricsServer starts the HTTP metrics server on the given address.
func StartWebUI ¶ added in v0.0.8
StartWebUI starts the dashboard server from a config address string.
Types ¶
type AddHandler ¶
type AddHandler interface {
AddHandler(name, desc string, args []string, handlerfunc AddHandlerFunc) error
}
type AddHandlerFunc ¶
type AddHandlerFunc func(json.RawMessage) (interface{}, error)
type AllowedPublicKey ¶
type BlockedPublicKey ¶ added in v0.0.8
type Core ¶
type Core struct {
// This is the main data structure that holds everything else for a node
// We're going to keep our own copy of the provided config - that way we can
// guarantee that it will be covered by the mutex
phony.Inbox
*iwe.PacketConn
// contains filtered or unexported fields
}
The Core object represents the Uqda node. You should create a Core object for each Uqda node you plan to run.
func New ¶
func New(cert *tls.Certificate, logger Logger, opts ...SetupOption) (*Core, error)
func (*Core) AddPeer ¶
AddPeer adds a peer. This should be specified in the peer URI format, e.g.:
tcp://a.b.c.d:e socks://a.b.c.d:e/f.g.h.i:j
This adds the peer to the peer list, so that they will be called again if the connection drops.
func (*Core) Address ¶
Address gets the IPv6 address of the Uqda node. This is always a /128 address. The IPv6 address is only relevant when the node is operating as an IP router and often is meaningless when embedded into an application, unless that application also implements either VPN functionality or deals with IP packets specifically.
func (*Core) CallPeer ¶
CallPeer calls a peer once. This should be specified in the peer URI format, e.g.:
tcp://a.b.c.d:e socks://a.b.c.d:e/f.g.h.i:j
This does not add the peer to the peer list, so if the connection drops, the peer will not be called again automatically.
func (*Core) GetPaths ¶
func (c *Core) GetPaths() []PathEntryInfo
func (*Core) GetSessions ¶
func (c *Core) GetSessions() []SessionInfo
func (*Core) GetTree ¶
func (c *Core) GetTree() []TreeEntryInfo
func (*Core) Listen ¶
Listen starts a new listener (either TCP or TLS). The input should be a url.URL parsed from a string of the form e.g. "tcp://a.b.c.d:e". In the case of a link-local address, the interface should be provided as the second argument.
func (*Core) ListenLocal ¶
ListenLocal starts a listener, like the Listen function, but is used for more trustworthy situations where you want to ignore AllowedPublicKeys, i.e. with multicast listeners.
func (*Core) RemovePeer ¶
RemovePeer removes a peer. The peer should be specified in URI format, see AddPeer. The peer is not disconnected immediately.
func (*Core) RetryPeersNow ¶
func (c *Core) RetryPeersNow()
func (*Core) SetAdmin ¶
func (c *Core) SetAdmin(a AddHandler) error
SetAdmin must be called after Init and before Start. It sets the admin handler for NodeInfo and the Debug admin functions.
func (*Core) SetLogger ¶
SetLogger sets the output logger of the Uqda node after startup. This may be useful if you want to redirect the output later. Note that this expects a Logger from the github.com/gologme/log package and not from Go's built-in log package.
func (*Core) SetPathNotify ¶
func (*Core) Subnet ¶
Subnet gets the routed IPv6 subnet of the Uqda node. This is always a /64 subnet. The IPv6 subnet is only relevant when the node is operating as an IP router and often is meaningless when embedded into an application, unless that application also implements either VPN functionality or deals with IP packets specifically.
type DebugGetPeersRequest ¶
type DebugGetPeersRequest struct {
Key string `json:"key"`
}
type DebugGetPeersResponse ¶
type DebugGetPeersResponse map[string]interface{}
type DebugGetSelfRequest ¶
type DebugGetSelfRequest struct {
Key string `json:"key"`
}
type DebugGetSelfResponse ¶
type DebugGetSelfResponse map[string]interface{}
type DebugGetTreeRequest ¶
type DebugGetTreeRequest struct {
Key string `json:"key"`
}
type DebugGetTreeResponse ¶
type DebugGetTreeResponse map[string]interface{}
type DebugRemoteEnabled ¶ added in v0.0.7
type DebugRemoteEnabled bool
type GetNodeInfoRequest ¶
type GetNodeInfoRequest struct {
Key string `json:"key"`
}
type GetNodeInfoResponse ¶
type GetNodeInfoResponse map[string]json.RawMessage
type ListenAddress ¶
type ListenAddress string
type Listener ¶
type Listener struct {
Cancel context.CancelFunc
// contains filtered or unexported fields
}
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
Println(...interface{})
Infof(string, ...interface{})
Infoln(...interface{})
Warnf(string, ...interface{})
Warnln(...interface{})
Errorf(string, ...interface{})
Errorln(...interface{})
Debugf(string, ...interface{})
Debugln(...interface{})
Traceln(...interface{})
}
type MetricsHandler ¶ added in v0.0.8
type MetricsHandler struct {
// contains filtered or unexported fields
}
MetricsHandler exposes Prometheus-formatted metrics via HTTP.
func NewMetricsHandler ¶ added in v0.0.8
func NewMetricsHandler(c *Core) *MetricsHandler
NewMetricsHandler creates a new metrics handler.
func (*MetricsHandler) ServeHTTP ¶ added in v0.0.8
func (m *MetricsHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request)
ServeHTTP handles HTTP requests and returns Prometheus-formatted metrics.
type NodeInfoPrivacy ¶
type NodeInfoPrivacy bool
type PathEntryInfo ¶
type PeerFilter ¶
type SessionInfo ¶
type SetupOption ¶
type SetupOption interface {
// contains filtered or unexported methods
}
type TreeEntryInfo ¶
type UIServer ¶ added in v0.0.8
type UIServer struct {
// contains filtered or unexported fields
}
UIServer serves the web dashboard and proxies API calls to the admin socket.
func NewUIServer ¶ added in v0.0.8
NewUIServer creates a new UI server.