Documentation ¶
Overview ¶
Package network implements utilities for dialing and listening to secret-handshake powered muxrpc connections.
Index ¶
- Constants
- func NewAcceptAllTracker() ssb.ConnTracker
- func NewConnTracker() ssb.ConnTracker
- func NewInstrumentedConnTracker(r ssb.ConnTracker, ct metrics.Gauge, h metrics.Histogram) ssb.ConnTracker
- func NewLastWinsTracker() ssb.ConnTracker
- type Advertiser
- type Discoverer
- type Node
- func (n *Node) Close() error
- func (n *Node) Connect(ctx context.Context, addr net.Addr) error
- func (n *Node) DialViaRoom(portal, target refs.FeedRef) error
- func (n *Node) GetAllEndpoints() []ssb.EndpointStat
- func (n *Node) GetConnTracker() ssb.ConnTracker
- func (n *Node) GetEndpointFor(ref refs.FeedRef) (muxrpc.Endpoint, bool)
- func (n *Node) GetListenAddr() net.Addr
- func (n *Node) HandleHTTP(h http.Handler)
- func (n *Node) Serve(ctx context.Context, wrappers ...muxrpc.HandlerWrapper) error
- func (n *Node) TunnelPlugin() ssb.Plugin
- type Options
Constants ¶
const DefaultPort = 8008
DefaultPort is the default listening port for ScuttleButt.
Variables ¶
This section is empty.
Functions ¶
func NewAcceptAllTracker ¶
func NewAcceptAllTracker() ssb.ConnTracker
This just keeps a count and doesn't actually track anything
func NewConnTracker ¶
func NewConnTracker() ssb.ConnTracker
func NewInstrumentedConnTracker ¶
func NewInstrumentedConnTracker(r ssb.ConnTracker, ct metrics.Gauge, h metrics.Histogram) ssb.ConnTracker
func NewLastWinsTracker ¶
func NewLastWinsTracker() ssb.ConnTracker
NewLastWinsTracker returns a conntracker that just kills the previous connection and let's the new one in.
Types ¶
type Advertiser ¶
type Advertiser struct {
// contains filtered or unexported fields
}
func NewAdvertiser ¶
func (*Advertiser) Start ¶
func (b *Advertiser) Start()
func (*Advertiser) Stop ¶
func (b *Advertiser) Stop()
type Discoverer ¶
type Discoverer struct {
// contains filtered or unexported fields
}
func NewDiscoverer ¶
func NewDiscoverer(local ssb.KeyPair) (*Discoverer, error)
func (*Discoverer) Notify ¶
func (d *Discoverer) Notify() (<-chan net.Addr, func())
func (*Discoverer) Stop ¶
func (d *Discoverer) Stop()
type Node ¶ added in v0.2.1
type Node struct {
// contains filtered or unexported fields
}
func (*Node) DialViaRoom ¶ added in v0.2.1
func (*Node) GetAllEndpoints ¶ added in v0.2.1
func (n *Node) GetAllEndpoints() []ssb.EndpointStat
TODO: merge with conntracker
func (*Node) GetConnTracker ¶ added in v0.2.1
func (n *Node) GetConnTracker() ssb.ConnTracker
func (*Node) GetEndpointFor ¶ added in v0.2.1
GetEndpointFor returns a muxrpc endpoint to call the remote identified by the passed feed ref retruns false if there is no such connection TODO: merge with conntracker
func (*Node) GetListenAddr ¶ added in v0.2.1
GetListenAddr waits for Serve() to be called!
func (*Node) HandleHTTP ¶ added in v0.2.1
func (*Node) Serve ¶ added in v0.2.1
Serve starts the network listener and configured resources like local discovery. Canceling the passed context makes the function return. Defers take care of stopping these resources.
func (*Node) TunnelPlugin ¶ added in v0.2.1
TunnelPlugin returns a muxrpc plugin that is able to handle incoming tunnel.connect requests
type Options ¶
type Options struct { Logger log.Logger Dialer netwrap.Dialer ListenAddr net.Addr AdvertsSend bool AdvertsConnectTo bool KeyPair ssb.KeyPair AppKey []byte MakeHandler func(net.Conn) (muxrpc.Handler, error) ConnTracker ssb.ConnTracker // PreSecureWrappers are applied before the shs+boxstream wrapping takes place // usefull for accessing the sycall.Conn to apply control options on the socket BefreCryptoWrappers []netwrap.ConnWrapper // AfterSecureWrappers are applied afterwards, usefull to debug muxrpc content AfterSecureWrappers []netwrap.ConnWrapper EventCounter metrics.Counter SystemGauge metrics.Gauge Latency metrics.Histogram EndpointWrapper func(muxrpc.Endpoint) muxrpc.Endpoint WebsocketAddr string }