Documentation
¶
Overview ¶
Package meshnet provides the core networking functionality for WebMesh.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DNSManager ¶
type DNSManager interface {
// Resolver returns a net.Resolver that can be used to resolve DNS names.
Resolver() *net.Resolver
// AddServers adds the given dns servers to the system configuration.
AddServers(ctx context.Context, servers []netip.AddrPort) error
// RefreshServers checks which peers in the database are offering DNS
// and updates the system configuration accordingly.
RefreshServers(ctx context.Context) error
}
DNSManager is an interface for managing DNS nameservers on the local system.
type Manager ¶
type Manager interface {
transport.Dialer
// Start starts the network manager.
Start(ctx context.Context, opts StartOptions) error
// NetworkV4 returns the current IPv4 network. The returned value may be invalid.
NetworkV4() netip.Prefix
// NetworkV6 returns the current IPv6 network, even if it is disabled.
NetworkV6() netip.Prefix
// StartMasquerade ensures that masquerading is enabled.
StartMasquerade(ctx context.Context) error
// DNS returns the DNS server manager. The DNS server manager is only
// available after Start has been called.
DNS() DNSManager
// Peers return the peer manager.
Peers() PeerManager
// Firewall returns the firewall.
// The firewall is only available after Start has been called.
Firewall() firewall.Firewall
// WireGuard returns the wireguard interface.
// The wireguard interface is only available after Start has been called.
WireGuard() wireguard.Interface
// Close closes the network manager and cleans up any resources.
Close(ctx context.Context) error
}
Manager is the interface for managing the network.
type Options ¶
type Options struct {
// NodeID is the ID of the node.
NodeID string
// InterfaceName is the name of the wireguard interface.
InterfaceName string
// ForceReplace is whether to force replace the wireguard interface.
ForceReplace bool
// ListenPort is the port to use for wireguard.
ListenPort int
// PersistentKeepAlive is the persistent keepalive to use for wireguard.
PersistentKeepAlive time.Duration
// ForceTUN is whether to force the use of TUN.
ForceTUN bool
// MTU is the MTU to use for the wireguard interface.
MTU int
// RecordMetrics is whether to enable metrics recording.
RecordMetrics bool
// RecordMetricsInterval is the interval to use for recording metrics.
RecordMetricsInterval time.Duration
// StoragePort is the port being used for the storage provider.
StoragePort int
// GRPCPort is the port being used for gRPC.
GRPCPort int
// ZoneAwarenessID is the zone awareness ID.
ZoneAwarenessID string
// DialOptions are the dial options to use when calling peer nodes.
DialOptions []grpc.DialOption
// LocalDNSAddr is a local network address service MeshDNS.
LocalDNSAddr netip.AddrPort
// DisableIPv4 disables IPv4 on the interface.
DisableIPv4 bool
// DisableIPv6 disables IPv6 on the interface.
DisableIPv6 bool
// Relays are options for when presented with the need to negotiate
// p2p data channels.
Relays RelayOptions
}
Options are the options for the network manager.
type PeerManager ¶
type PeerManager interface {
// AddPeer adds a peer to the wireguard interface. IceServers is optional
// and provides a hint of mesh nodes that provide WebRTC signaling if
// required.
Add(ctx context.Context, peer *v1.WireGuardPeer, iceServers []string) error
// RefreshPeers walks all peers against the provided list and makes sure
// they are up to date.
Refresh(ctx context.Context, peers []*v1.WireGuardPeer) error
}
PeerManager is the interface for tracking and managing WireGuard peers.
type RelayOptions ¶
type RelayOptions struct {
// Host are the options for a libp2p host.
Host libp2p.HostOptions
}
RelayOptions are options for when presented with the need to negotiate p2p wireguard connections. Empty values mean to use the defaults.
type StartOptions ¶
type StartOptions struct {
// Key is the wireguard key to use for the node.
Key crypto.PrivateKey
// AddressV4 is the IPv4 address to use for the node.
AddressV4 netip.Prefix
// AddressV6 is the IPv6 address to use for the node.
AddressV6 netip.Prefix
// NetworkV4 is the IPv4 network to use for the node.
NetworkV4 netip.Prefix
// NetworkV6 is the IPv6 network to use for the node.
NetworkV6 netip.Prefix
}
StartOptions are the options for starting the network manager and configuring the wireguard interface.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package nat64 provides a stateless bi-directional NAT64 implementation.
|
Package nat64 provides a stateless bi-directional NAT64 implementation. |
|
Package relay holds low-level primitives for proxying streams to a WireGuard interface.
|
Package relay holds low-level primitives for proxying streams to a WireGuard interface. |
|
Package system contains utilities for managing network interfaces on the system.
|
Package system contains utilities for managing network interfaces on the system. |
|
buffers
Package buffers contains facilities for changing system buffer sizes.
|
Package buffers contains facilities for changing system buffer sizes. |
|
dns
Package dns contains utility functions for DNS.
|
Package dns contains utility functions for DNS. |
|
firewall
Package firewall contains an interface for interacting with the system firewall.
|
Package firewall contains an interface for interacting with the system firewall. |
|
Package transport defines the interfaces needed for various mesh operations.
|
Package transport defines the interfaces needed for various mesh operations. |
|
datachannels
Package datachannels provides a WebRTC data channel API for port forwarding.
|
Package datachannels provides a WebRTC data channel API for port forwarding. |
|
libp2p
Package libp2p provides webmesh integration with libp2p.
|
Package libp2p provides webmesh integration with libp2p. |
|
tcp
Package tcp provides TCP based transports.
|
Package tcp provides TCP based transports. |
|
package util provides common utility functions for networking.
|
package util provides common utility functions for networking. |
|
Package wireguard contains utilities for working with wireguard interfaces.
|
Package wireguard contains utilities for working with wireguard interfaces. |
Click to show internal directories.
Click to hide internal directories.