Documentation
¶
Index ¶
- Constants
- func AddMetric(a, b uint32) uint32
- func Bootstrap(centralPath, nodePath, logPath string, verbose bool)
- func CleanupWireGuardDevice(s *state.State, n *Nylon) error
- func ComputeRoutes(s *state.RouterState, r Router)
- func ConfigureAlias(ifName string, prefix netip.Prefix) error
- func ConfigureRoute(dev tun.Device, itfName string, route netip.Prefix, via netip.Addr) error
- func Exec(name string, arg ...string) error
- func FetchConfig(repoStr string, key state.NyPublicKey) (*state.CentralCfg, error)
- func FullTableUpdate(s *state.RouterState, r Router)
- func Get[T state.NyModule](s *state.State) T
- func HandleAckRetract(s *state.RouterState, r Router, neighId state.NodeId, svc state.ServiceId)
- func HandleNeighbourUpdate(s *state.RouterState, r Router, neighId state.NodeId, adv state.PubRoute)
- func HandleNylonIPCGet(s *state.State, rw *bufio.ReadWriter) error
- func HandleSeqnoRequest(s *state.RouterState, r Router, fromNeigh state.NodeId, src state.Source, ...)
- func IPCGet(itf string) (string, error)
- func InitInterface(ifName string) error
- func InitUAPI(e *state.Env, itfName string) (net.Listener, error)
- func MainLoop(s *state.State, dispatch <-chan func(*state.State) error) error
- func NeighContainsFunc(s *state.RouterState, f func(neigh state.NodeId, route state.NeighRoute) bool) bool
- func NewWireGuardDevice(s *state.State, n *Nylon) (dev *device.Device, tunDevice tun.Device, realItf string, err error)
- func PushFullTable(s *state.RouterState, r Router, neigh state.NodeId)
- func RunGC(s *state.RouterState, r Router)
- func SeqnoGe(a, b uint16) bool
- func SeqnoGt(a, b uint16) bool
- func SeqnoLe(a, b uint16) bool
- func SeqnoLt(a, b uint16) bool
- func ShouldSwitch(curRoute state.SelRoute, newRoute state.SelRoute) bool
- func SolveStarvation(router *state.RouterState, r Router)
- func Start(ccfg state.CentralCfg, ncfg state.LocalCfg, logLevel slog.Level, ...) (bool, error)
- func Stop(s *state.State)
- func UpdateWireGuard(s *state.State) error
- func VerifyForwarding() error
- type EpPing
- type IOPending
- type Nylon
- func (n *Nylon) Cleanup(s *state.State) error
- func (n *Nylon) Init(s *state.State) error
- func (n *Nylon) InstallTC(s *state.State)
- func (n *Nylon) Probe(ep *state.NylonEndpoint) error
- func (n *Nylon) SendNylon(pkt *protocol.Ny, endpoint conn.Endpoint, peer *device.Peer) error
- func (n *Nylon) SendNylonBundle(pkt *protocol.TransportBundle, endpoint conn.Endpoint, peer *device.Peer) error
- type NylonRouter
- func (r *NylonRouter) BroadcastRequestSeqno(src state.Source, seqno uint16, hopCnt uint8)
- func (r *NylonRouter) BroadcastSendRouteUpdate(advRoute state.PubRoute)
- func (r *NylonRouter) Cleanup(s *state.State) error
- func (r *NylonRouter) GcRouter(s *state.State) error
- func (r *NylonRouter) GetNeighIO(neigh state.NodeId) *IOPending
- func (r *NylonRouter) Init(s *state.State) error
- func (r *NylonRouter) Log(event RouterEvent, desc string, args ...any)
- func (r *NylonRouter) RequestSeqno(neigh state.NodeId, src state.Source, seqno uint16, hopCnt uint8)
- func (r *NylonRouter) SendAckRetract(neigh state.NodeId, svc state.ServiceId)
- func (r *NylonRouter) SendRouteUpdate(neigh state.NodeId, advRoute state.PubRoute)
- func (r *NylonRouter) TableDeleteRoute(svc state.ServiceId)
- func (r *NylonRouter) TableInsertRoute(svc state.ServiceId, route state.SelRoute)
- func (r *NylonRouter) UpdateNeighbour(neigh state.NodeId)
- type RouteTableEntry
- type Router
- type RouterEvent
Constants ¶
View Source
const (
NyProtoId = 8
)
Variables ¶
This section is empty.
Functions ¶
func Bootstrap ¶ added in v0.3.3
Bootstrap manages the lifetime of the whole application. Nylon may be restarted multiple times, but Bootstrap is only called once.
func ComputeRoutes ¶
func ComputeRoutes(s *state.RouterState, r Router)
func ConfigureRoute ¶
func FetchConfig ¶ added in v0.3.3
func FetchConfig(repoStr string, key state.NyPublicKey) (*state.CentralCfg, error)
fetches and unbundles central config from url
func FullTableUpdate ¶
func FullTableUpdate(s *state.RouterState, r Router)
func HandleAckRetract ¶
func HandleNeighbourUpdate ¶
func HandleNeighbourUpdate(s *state.RouterState, r Router, neighId state.NodeId, adv state.PubRoute)
this function should also be called on every probe
func HandleNylonIPCGet ¶
func HandleNylonIPCGet(s *state.State, rw *bufio.ReadWriter) error
func HandleSeqnoRequest ¶
func InitInterface ¶
func NeighContainsFunc ¶
func NeighContainsFunc(s *state.RouterState, f func(neigh state.NodeId, route state.NeighRoute) bool) bool
func NewWireGuardDevice ¶
func PushFullTable ¶
func PushFullTable(s *state.RouterState, r Router, neigh state.NodeId)
func RunGC ¶
func RunGC(s *state.RouterState, r Router)
func SolveStarvation ¶
func SolveStarvation(router *state.RouterState, r Router)
func UpdateWireGuard ¶
func VerifyForwarding ¶
func VerifyForwarding() error
Types ¶
type Nylon ¶
type Nylon struct {
PingBuf *ttlcache.Cache[uint64, EpPing]
Device *device.Device
Tun tun.Device
// contains filtered or unexported fields
}
Nylon struct must be thread safe, since it can receive packets through PolyReceiver
func (*Nylon) SendNylonBundle ¶
type NylonRouter ¶
type NylonRouter struct {
*state.State
LastStarvationRequest time.Time
IO map[state.NodeId]*IOPending
// ForwardTable contains the full routing table
ForwardTable bart.Table[RouteTableEntry]
// LoopbackTable contains only routes to services hosted on this node
LoopbackTable bart.Table[RouteTableEntry]
}
func (*NylonRouter) BroadcastRequestSeqno ¶
func (r *NylonRouter) BroadcastRequestSeqno(src state.Source, seqno uint16, hopCnt uint8)
func (*NylonRouter) BroadcastSendRouteUpdate ¶
func (r *NylonRouter) BroadcastSendRouteUpdate(advRoute state.PubRoute)
func (*NylonRouter) GetNeighIO ¶
func (r *NylonRouter) GetNeighIO(neigh state.NodeId) *IOPending
func (*NylonRouter) Log ¶
func (r *NylonRouter) Log(event RouterEvent, desc string, args ...any)
func (*NylonRouter) RequestSeqno ¶
func (*NylonRouter) SendAckRetract ¶
func (r *NylonRouter) SendAckRetract(neigh state.NodeId, svc state.ServiceId)
func (*NylonRouter) SendRouteUpdate ¶
func (r *NylonRouter) SendRouteUpdate(neigh state.NodeId, advRoute state.PubRoute)
func (*NylonRouter) TableDeleteRoute ¶
func (r *NylonRouter) TableDeleteRoute(svc state.ServiceId)
func (*NylonRouter) TableInsertRoute ¶
func (r *NylonRouter) TableInsertRoute(svc state.ServiceId, route state.SelRoute)
func (*NylonRouter) UpdateNeighbour ¶
func (r *NylonRouter) UpdateNeighbour(neigh state.NodeId)
type Router ¶
type Router interface {
SendRouteUpdate(neigh state.NodeId, advRoute state.PubRoute)
SendAckRetract(neigh state.NodeId, svc state.ServiceId)
BroadcastSendRouteUpdate(advRoute state.PubRoute)
RequestSeqno(neigh state.NodeId, src state.Source, seqno uint16, hopCnt uint8)
BroadcastRequestSeqno(src state.Source, seqno uint16, hopCnt uint8)
TableInsertRoute(svc state.ServiceId, route state.SelRoute)
TableDeleteRoute(svc state.ServiceId)
Log(event RouterEvent, desc string, args ...any)
}
Router is an interface that defines the underlying router operations
type RouterEvent ¶
type RouterEvent int
const ( InconsistentState RouterEvent = iota + 1000 NoEpToNeighbour )
const ( RouteChanged RouterEvent = iota + 2000 RouteExpired RoutePushed RouteStarved )
info events
func (RouterEvent) String ¶
func (i RouterEvent) String() string
Click to show internal directories.
Click to hide internal directories.