Documentation
¶
Index ¶
- Constants
- type BaseInterface
- func (i *BaseInterface) Detach()
- func (i *BaseInterface) Disable()
- func (i *BaseInterface) Enable()
- func (i *BaseInterface) GetBandwidthAvailable() bool
- func (i *BaseInterface) GetConn() net.Conn
- func (i *BaseInterface) GetMTU() int
- func (i *BaseInterface) GetMode() InterfaceMode
- func (i *BaseInterface) GetName() string
- func (i *BaseInterface) GetPacketCallback() PacketCallback
- func (i *BaseInterface) GetType() InterfaceType
- func (i *BaseInterface) IsDetached() bool
- func (i *BaseInterface) IsEnabled() bool
- func (i *BaseInterface) IsOnline() bool
- func (i *BaseInterface) ProcessIncoming(data []byte)
- func (i *BaseInterface) ProcessOutgoing(data []byte) error
- func (i *BaseInterface) Send(data []byte, address string) error
- func (i *BaseInterface) SendLinkPacket(dest []byte, data []byte, timestamp time.Time) error
- func (i *BaseInterface) SendPathRequest(data []byte) error
- func (i *BaseInterface) SetPacketCallback(callback PacketCallback)
- func (i *BaseInterface) Start() error
- func (i *BaseInterface) Stop() error
- type ConfigProvider
- type InterfaceConfig
- type InterfaceMode
- type InterfaceType
- type LinkEstablishedCallback
- type LinkStatus
- type NetworkInterface
- type NetworkStats
- type PacketCallback
- type Path
- type PathRequest
- type PathResponse
- type PathStatus
- type ProofRequestedCallback
- type RatchetIDReceiver
- type RequestHandler
- type ReticulumConfig
- type TransportMode
Constants ¶
const ( DEFAULT_SHARED_INSTANCE_PORT = 37428 DEFAULT_INSTANCE_CONTROL_PORT = 37429 DEFAULT_LOG_LEVEL = 20 )
const ( // Interface Types IF_TYPE_NONE InterfaceType = iota IF_TYPE_UDP IF_TYPE_TCP IF_TYPE_UNIX IF_TYPE_I2P IF_TYPE_BLUETOOTH IF_TYPE_SERIAL IF_TYPE_AUTO // Interface Modes IF_MODE_FULL InterfaceMode = iota IF_MODE_POINT IF_MODE_GATEWAY IF_MODE_ACCESS_POINT IF_MODE_ROAMING IF_MODE_BOUNDARY // Transport Modes TRANSPORT_MODE_DIRECT TransportMode = iota TRANSPORT_MODE_RELAY TRANSPORT_MODE_GATEWAY // Path Status PATH_STATUS_UNKNOWN PathStatus = iota PATH_STATUS_DIRECT PATH_STATUS_RELAY PATH_STATUS_FAILED // Resource Status RESOURCE_STATUS_PENDING = 0x00 RESOURCE_STATUS_ACTIVE = 0x01 RESOURCE_STATUS_COMPLETE = 0x02 RESOURCE_STATUS_FAILED = 0x03 RESOURCE_STATUS_CANCELLED = 0x04 // Link Status LINK_STATUS_PENDING = 0x00 LINK_STATUS_ACTIVE = 0x01 LINK_STATUS_CLOSED = 0x02 LINK_STATUS_FAILED = 0x03 // Direction Constants IN = 0x01 OUT = 0x02 // Common Constants DEFAULT_MTU = 1500 MAX_PACKET_SIZE = 65535 BITRATE_MINIMUM = 5 // Timeouts and Intervals ESTABLISH_TIMEOUT = 6 KEEPALIVE_INTERVAL = 360 STALE_TIME = 720 PATH_REQUEST_TTL = 300 ANNOUNCE_TIMEOUT = 15 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseInterface ¶
type BaseInterface struct { Name string Mode InterfaceMode Type InterfaceType Online bool Enabled bool Detached bool IN bool OUT bool MTU int Bitrate int64 TxBytes uint64 RxBytes uint64 Mutex sync.RWMutex Owner interface{} PacketCallback PacketCallback // contains filtered or unexported fields }
BaseInterface provides common implementation for network interfaces
func NewBaseInterface ¶
func NewBaseInterface(name string, ifaceType InterfaceType, enabled bool) BaseInterface
NewBaseInterface creates a new BaseInterface instance
func (*BaseInterface) Detach ¶
func (i *BaseInterface) Detach()
func (*BaseInterface) Disable ¶
func (i *BaseInterface) Disable()
func (*BaseInterface) Enable ¶
func (i *BaseInterface) Enable()
func (*BaseInterface) GetBandwidthAvailable ¶
func (i *BaseInterface) GetBandwidthAvailable() bool
func (*BaseInterface) GetConn ¶
func (i *BaseInterface) GetConn() net.Conn
func (*BaseInterface) GetMTU ¶
func (i *BaseInterface) GetMTU() int
func (*BaseInterface) GetMode ¶
func (i *BaseInterface) GetMode() InterfaceMode
func (*BaseInterface) GetName ¶
func (i *BaseInterface) GetName() string
func (*BaseInterface) GetPacketCallback ¶
func (i *BaseInterface) GetPacketCallback() PacketCallback
func (*BaseInterface) GetType ¶
func (i *BaseInterface) GetType() InterfaceType
Default implementations for BaseInterface
func (*BaseInterface) IsDetached ¶
func (i *BaseInterface) IsDetached() bool
func (*BaseInterface) IsEnabled ¶
func (i *BaseInterface) IsEnabled() bool
func (*BaseInterface) IsOnline ¶
func (i *BaseInterface) IsOnline() bool
func (*BaseInterface) ProcessIncoming ¶
func (i *BaseInterface) ProcessIncoming(data []byte)
func (*BaseInterface) ProcessOutgoing ¶
func (i *BaseInterface) ProcessOutgoing(data []byte) error
func (*BaseInterface) SendLinkPacket ¶
func (*BaseInterface) SendPathRequest ¶
func (i *BaseInterface) SendPathRequest(data []byte) error
func (*BaseInterface) SetPacketCallback ¶
func (i *BaseInterface) SetPacketCallback(callback PacketCallback)
func (*BaseInterface) Start ¶
func (i *BaseInterface) Start() error
Default implementations that should be overridden by specific interfaces
func (*BaseInterface) Stop ¶
func (i *BaseInterface) Stop() error
type ConfigProvider ¶
type ConfigProvider interface { GetConfigPath() string GetLogLevel() int GetInterfaces() map[string]InterfaceConfig }
ConfigProvider interface for accessing configuration
type InterfaceConfig ¶
type InterfaceConfig struct { Name string Type string Enabled bool Address string Port int TargetHost string TargetPort int TargetAddress string Interface string KISSFraming bool I2PTunneled bool PreferIPv6 bool MaxReconnTries int Bitrate int64 MTU int GroupID string DiscoveryScope string DiscoveryPort int DataPort int }
InterfaceConfig represents interface configuration
type InterfaceType ¶
type InterfaceType byte
type LinkEstablishedCallback ¶
type LinkEstablishedCallback func(interface{})
type LinkStatus ¶
type LinkStatus struct { Established bool LastSeen time.Time RTT time.Duration Quality float64 Hops uint8 }
LinkStatus represents the current state of a link
type NetworkInterface ¶
type NetworkInterface interface { // Core interface operations Start() error Stop() error Enable() Disable() Detach() // Network operations Send(data []byte, address string) error GetConn() net.Conn GetMTU() int GetName() string // Interface properties GetType() InterfaceType GetMode() InterfaceMode IsEnabled() bool IsOnline() bool IsDetached() bool GetBandwidthAvailable() bool // Packet handling ProcessIncoming([]byte) ProcessOutgoing([]byte) error SendPathRequest([]byte) error SendLinkPacket([]byte, []byte, time.Time) error SetPacketCallback(PacketCallback) GetPacketCallback() PacketCallback }
NetworkInterface defines the interface for all network communication methods
type NetworkStats ¶
type NetworkStats struct { BytesSent uint64 BytesReceived uint64 PacketsSent uint64 PacketsReceived uint64 LastUpdated time.Time }
NetworkStats holds interface statistics
type PacketCallback ¶
type PacketCallback func([]byte, NetworkInterface)
type Path ¶
type Path struct { Interface NetworkInterface LastSeen time.Time NextHop []byte Hops uint8 LastUpdated time.Time HopCount uint8 }
Path represents routing information for a destination
type PathRequest ¶
PathRequest represents a path discovery request
type PathResponse ¶
PathResponse represents a path discovery response
type PathStatus ¶
type PathStatus byte
type RatchetIDReceiver ¶
type RatchetIDReceiver struct {
LatestRatchetID []byte
}
RatchetIDReceiver holds ratchet ID information
type RequestHandler ¶
type RequestHandler struct { Path string ResponseGenerator func(path string, data []byte, requestID []byte, linkID []byte, remoteIdentity interface{}, requestedAt int64) []byte AllowMode byte AllowedList [][]byte }
RequestHandler manages path requests and responses
type ReticulumConfig ¶
type ReticulumConfig struct { ConfigPath string EnableTransport bool InstanceControlPort int PanicOnInterfaceErr bool LogLevel int Interfaces map[string]*InterfaceConfig AppName string AppAspect string }
ReticulumConfig represents the main configuration structure
func DefaultConfig ¶
func DefaultConfig() *ReticulumConfig
func NewReticulumConfig ¶
func NewReticulumConfig() *ReticulumConfig
NewReticulumConfig creates a new ReticulumConfig with default values
func (*ReticulumConfig) Validate ¶
func (c *ReticulumConfig) Validate() error
Validate checks if the configuration is valid