connections

package
v0.0.0-...-b5ba5ed Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MPL-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAllowedNetwork

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 ConnectionStatusEntry

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

type ListenerAddresses

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

type ListenerStatusEntry

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

type Model

type Model interface {
	protocol.Model
	AddConnection(conn protocol.Connection, hello protocol.Hello)
	OnHello(protocol.DeviceID, net.Addr, protocol.Hello) error
	DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error)
}

type Service

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

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

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
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