connections

package
v1.6.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MPL-2.0 Imports: 31 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAllowedNetwork added in v0.14.27

func IsAllowedNetwork(host string, allowed []string) bool

IsAllowedNetwork returns true if the given host (IP or resolvable hostname) is in the set of allowed networks (CIDR format only).

Types

type Connection added in v0.13.0

type Connection interface {
	protocol.Connection
	Type() string
	Transport() string
	RemoteAddr() net.Addr
	Priority() int
	String() string
	Crypto() string
}

Connection is what we expose to the outside. It is a protocol.Connection that can be closed and has some metadata.

type ConnectionStatusEntry added in v1.2.0

type ConnectionStatusEntry struct {
	When  time.Time `json:"when"`
	Error *string   `json:"error"`
}

type ListenerAddresses added in v1.6.0

type ListenerAddresses struct {
	URI          *url.URL
	WANAddresses []*url.URL
	LANAddresses []*url.URL
}

type ListenerStatusEntry added in v1.2.0

type ListenerStatusEntry struct {
	Error        *string  `json:"error"`
	LANAddresses []string `json:"lanAddresses"`
	WANAddresses []string `json:"wanAddresses"`
}

type Model

type Model interface {
	protocol.Model
	AddConnection(conn Connection, hello protocol.HelloResult)
	Connection(remoteID protocol.DeviceID) (Connection, bool)
	OnHello(protocol.DeviceID, net.Addr, protocol.HelloResult) error
	GetHello(protocol.DeviceID) protocol.HelloIntf
}

type Service added in v0.13.0

type Service interface {
	suture.Service
	discover.AddressLister
	ListenerStatus() map[string]ListenerStatusEntry
	ConnectionStatus() map[string]ConnectionStatusEntry
	NATType() string
}

Service listens and dials all configured unconnected devices, via supported dialers. Successful connections are handed to the model.

func NewService added in v0.13.0

func NewService(cfg config.Wrapper, myID protocol.DeviceID, mdl Model, tlsCfg *tls.Config, discoverer discover.Finder, bepProtocolName string, tlsDefaultCommonName string, evLogger events.Logger) Service

Directories

Path Synopsis
Registry tracks connections/addresses on which we are listening on, to allow us to pick a connection/address that has a NAT port mapping.
Registry tracks connections/addresses on which we are listening on, to allow us to pick a connection/address that has a NAT port mapping.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL