0.2.4
This commit is contained in:
@@ -6,11 +6,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type InterfaceMode byte
|
||||
type InterfaceType byte
|
||||
|
||||
type PacketCallback = func([]byte, interface{})
|
||||
|
||||
// NetworkInterface combines both low-level and high-level interface requirements
|
||||
type NetworkInterface interface {
|
||||
// Low-level network operations
|
||||
@@ -21,7 +16,7 @@ type NetworkInterface interface {
|
||||
GetType() InterfaceType
|
||||
GetMode() InterfaceMode
|
||||
GetMTU() int
|
||||
|
||||
|
||||
// High-level packet operations
|
||||
ProcessIncoming([]byte)
|
||||
ProcessOutgoing([]byte) error
|
||||
@@ -29,7 +24,7 @@ type NetworkInterface interface {
|
||||
SendLinkPacket([]byte, []byte, time.Time) error
|
||||
Detach()
|
||||
SetPacketCallback(PacketCallback)
|
||||
|
||||
|
||||
// Additional required fields
|
||||
GetName() string
|
||||
GetConn() net.Conn
|
||||
@@ -38,23 +33,23 @@ type NetworkInterface interface {
|
||||
|
||||
// BaseInterface provides common implementation
|
||||
type BaseInterface struct {
|
||||
Name string
|
||||
Mode InterfaceMode
|
||||
Type InterfaceType
|
||||
|
||||
Name string
|
||||
Mode InterfaceMode
|
||||
Type InterfaceType
|
||||
|
||||
Online bool
|
||||
Detached bool
|
||||
|
||||
IN bool
|
||||
OUT bool
|
||||
|
||||
MTU int
|
||||
Bitrate int64
|
||||
|
||||
TxBytes uint64
|
||||
RxBytes uint64
|
||||
|
||||
Mutex sync.RWMutex
|
||||
Owner interface{}
|
||||
|
||||
IN bool
|
||||
OUT bool
|
||||
|
||||
MTU int
|
||||
Bitrate int64
|
||||
|
||||
TxBytes uint64
|
||||
RxBytes uint64
|
||||
|
||||
Mutex sync.RWMutex
|
||||
Owner interface{}
|
||||
PacketCallback PacketCallback
|
||||
}
|
||||
}
|
||||
@@ -10,15 +10,15 @@ type PathStatus byte
|
||||
|
||||
// Common structs
|
||||
type Path struct {
|
||||
Interface NetworkInterface
|
||||
LastSeen time.Time
|
||||
NextHop []byte
|
||||
Hops uint8
|
||||
LastUpdated time.Time
|
||||
Interface NetworkInterface
|
||||
LastSeen time.Time
|
||||
NextHop []byte
|
||||
Hops uint8
|
||||
LastUpdated time.Time
|
||||
}
|
||||
|
||||
// Common callbacks
|
||||
type ProofRequestedCallback func(interface{}) bool
|
||||
type ProofRequestedCallback func([]byte, []byte)
|
||||
type LinkEstablishedCallback func(interface{})
|
||||
|
||||
// Request handler
|
||||
@@ -27,4 +27,10 @@ type RequestHandler struct {
|
||||
ResponseGenerator func(path string, data []byte, requestID []byte, linkID []byte, remoteIdentity interface{}, requestedAt int64) []byte
|
||||
AllowMode byte
|
||||
AllowedList [][]byte
|
||||
}
|
||||
}
|
||||
|
||||
type InterfaceMode byte
|
||||
type InterfaceType byte
|
||||
|
||||
// PacketCallback defines the function signature for packet handling
|
||||
type PacketCallback func([]byte, interface{})
|
||||
|
||||
Reference in New Issue
Block a user