face

package
v0.0.0-...-d1ba03b Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FaceFlagLocalFields = 1 << iota
	FaceFlagLpReliabilityEnabled
	FaceFlagCongestionMarking
)

Variables

View Source
var StubTcpUri = defn.DecodeURIString("tcp://127.0.0.1:0")

URI to use when the local URI is unknown.

Functions

func CfgCongestionMarking

func CfgCongestionMarking() bool

CfgCongestionMarking returns whether congestion marking is enabled or disabled.

func CfgFaceQueueSize

func CfgFaceQueueSize() int

CfgFaceQueueSize returns the maximum number of packets that can be buffered to be sent or received on a face.

func CfgLockThreadsToCores

func CfgLockThreadsToCores() bool

CfgLockThreadsToCores returns whether face threads will be locked to logical cores.

func CfgTCPLifetime

func CfgTCPLifetime() time.Duration

CfgTCPLifetime returns the lifetime of on-demand TCP faces after they become idle.

func CfgTCPUnicastPort

func CfgTCPUnicastPort() int

CfgTCPUnicastPort returns the configured unicast TCP port.

func CfgUDP4MulticastAddress

func CfgUDP4MulticastAddress() string

CfgUDP4MulticastAddress returns the configured multicast UDP4 address.

func CfgUDP6MulticastAddress

func CfgUDP6MulticastAddress() string

CfgUDP6MulticastAddress returns the configured multicast UDP6 address.

func CfgUDPLifetime

func CfgUDPLifetime() time.Duration

CfgUDPLifetime returns the lifetime of on-demand UDP faces after they become idle.

func CfgUDPMulticastPort

func CfgUDPMulticastPort() int

CfgUDPMulticastPort returns the configured multicast UDP port.

func CfgUDPUnicastPort

func CfgUDPUnicastPort() int

CfgUDPUnicastPort returns the configured unicast UDP port.

func CfgUnixSocketPath

func CfgUnixSocketPath() string

CfgUnixSocketPath returns the configured Unix socket file path.

func Initialize

func Initialize()

Initialize initializes the face module.

func InterfaceByIP

func InterfaceByIP(ip net.IP) (*net.Interface, error)

InterfaceByIP gets an interface by its IP address.

func InterfaceByMAC

func InterfaceByMAC(mac net.HardwareAddr) (*net.Interface, error)

InterfaceByMAC gets an interface by its MAC address.

func RegisterInternalTransport

func RegisterInternalTransport() (LinkService, *InternalTransport)

RegisterInternalTransport creates, registers, and starts an InternalTransport.

Types

type HTTP3Listener

type HTTP3Listener struct {
	// contains filtered or unexported fields
}

HTTP3Listener listens for incoming HTTP/3 WebTransport sessions.

func NewHTTP3Listener

func NewHTTP3Listener(cfg HTTP3ListenerConfig) (*HTTP3Listener, error)

Constructs an HTTP/3 WebTransport listener configured with TLS certificates, QUIC settings, and an NDN endpoint handler for "/ndn".

func (*HTTP3Listener) Run

func (l *HTTP3Listener) Run()

Starts the HTTP/3 listener and logs a fatal error if it fails to start.

func (*HTTP3Listener) String

func (l *HTTP3Listener) String() string

Returns a string representation of the HTTP/3 listener, which is "HTTP/3 listener".

type HTTP3ListenerConfig

type HTTP3ListenerConfig struct {
	Bind    string
	Port    uint16
	TLSCert string
	TLSKey  string
}

HTTP3ListenerConfig contains HTTP/3 WebTransport listener configuration.

func (HTTP3ListenerConfig) String

func (cfg HTTP3ListenerConfig) String() string

Returns a string representation of the HTTP3ListenerConfig in the format "http3-listener (url=...)", where ... is the URL returned by the config's URL() method.

func (HTTP3ListenerConfig) URL

func (cfg HTTP3ListenerConfig) URL() *url.URL

Constructs a URL with the HTTPS scheme and the configured listener address as the host.

type HTTP3Transport

type HTTP3Transport struct {
	// contains filtered or unexported fields
}

func NewHTTP3Transport

func NewHTTP3Transport(remote, local netip.AddrPort, c *webtransport.Session) (t *HTTP3Transport)

Constructs an HTTP3Transport using the provided WebTransport session, initializing it with remote and local address-port pairs along with default transport parameters for persistency, scope, and capacity.

func (*HTTP3Transport) Close

func (t *HTTP3Transport) Close()

Shuts down the HTTP/3 transport by stopping its operation and closing the underlying connection without reporting an error.

func (*HTTP3Transport) ExpirationPeriod

func (t *HTTP3Transport) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until this face expires. If transport not on-demand, returns 0.

func (*HTTP3Transport) FaceID

func (t *HTTP3Transport) FaceID() uint64

Returns the unique identifier of the face associated with this transport.

func (*HTTP3Transport) GetSendQueueSize

func (t *HTTP3Transport) GetSendQueueSize() uint64

Returns the current number of bytes queued for transmission in the HTTP/3 transport send buffer.

func (*HTTP3Transport) IsRunning

func (t *HTTP3Transport) IsRunning() bool

Returns whether the transport is currently running.

func (*HTTP3Transport) LinkType

func (t *HTTP3Transport) LinkType() defn.LinkType

Returns the link type of the transport as a `defn.LinkType` value.

func (*HTTP3Transport) LocalURI

func (t *HTTP3Transport) LocalURI() *defn.URI

Returns the local URI associated with the transport instance.

func (*HTTP3Transport) MTU

func (t *HTTP3Transport) MTU() int

Returns the maximum transmission unit (MTU) size for the transport.

func (*HTTP3Transport) NInBytes

func (t *HTTP3Transport) NInBytes() uint64

Returns the total number of bytes received by the transport.

func (*HTTP3Transport) NOutBytes

func (t *HTTP3Transport) NOutBytes() uint64

Returns the total number of bytes transmitted by this transport as a 64-bit unsigned integer.

func (*HTTP3Transport) Persistency

func (t *HTTP3Transport) Persistency() spec_mgmt.Persistency

Returns the persistency setting of the transport.

func (*HTTP3Transport) RemoteURI

func (t *HTTP3Transport) RemoteURI() *defn.URI

Returns the remote URI associated with the transport connection.

func (*HTTP3Transport) Scope

func (t *HTTP3Transport) Scope() defn.Scope

Returns the current scope of the transport base.

func (*HTTP3Transport) SetMTU

func (t *HTTP3Transport) SetMTU(mtu int)

Sets the Maximum Transmission Unit (MTU) for the transport, specifying the maximum size of data packets that can be transmitted.

func (*HTTP3Transport) SetPersistency

func (t *HTTP3Transport) SetPersistency(persistency spec_mgmt.Persistency) bool

Returns true if the persistency is set to OnDemand.

func (*HTTP3Transport) String

func (t *HTTP3Transport) String() string

Returns a string representation of the HTTP3Transport containing face ID, remote URI, and local URI for identification.

type InternalTransport

type InternalTransport struct {
	// contains filtered or unexported fields
}

InternalTransport is a transport for use by internal YaNFD modules (e.g., management).

func MakeInternalTransport

func MakeInternalTransport() *InternalTransport

MakeInternalTransport makes an InternalTransport.

func (*InternalTransport) Close

func (t *InternalTransport) Close()

Closes the internal transport, closing the receive queue and allowing the send queue to be garbage collected if the transport was running.

func (*InternalTransport) ExpirationPeriod

func (t *InternalTransport) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until this face expires. If transport not on-demand, returns 0.

func (*InternalTransport) FaceID

func (t *InternalTransport) FaceID() uint64

Returns the unique identifier of the face associated with this transport.

func (*InternalTransport) GetSendQueueSize

func (t *InternalTransport) GetSendQueueSize() uint64

GetSendQueueSize returns the current size of the send queue.

func (*InternalTransport) IsRunning

func (t *InternalTransport) IsRunning() bool

Returns whether the transport is currently running.

func (*InternalTransport) LinkType

func (t *InternalTransport) LinkType() defn.LinkType

Returns the link type of the transport as a `defn.LinkType` value.

func (*InternalTransport) LocalURI

func (t *InternalTransport) LocalURI() *defn.URI

Returns the local URI associated with the transport instance.

func (*InternalTransport) MTU

func (t *InternalTransport) MTU() int

Returns the maximum transmission unit (MTU) size for the transport.

func (*InternalTransport) NInBytes

func (t *InternalTransport) NInBytes() uint64

Returns the total number of bytes received by the transport.

func (*InternalTransport) NOutBytes

func (t *InternalTransport) NOutBytes() uint64

Returns the total number of bytes transmitted by this transport as a 64-bit unsigned integer.

func (*InternalTransport) Persistency

func (t *InternalTransport) Persistency() spec_mgmt.Persistency

Returns the persistency setting of the transport.

func (*InternalTransport) Receive

func (t *InternalTransport) Receive() *spec.LpPacket

Receive receives a packet from the perspective of the internal component.

func (*InternalTransport) RemoteURI

func (t *InternalTransport) RemoteURI() *defn.URI

Returns the remote URI associated with the transport connection.

func (*InternalTransport) Scope

func (t *InternalTransport) Scope() defn.Scope

Returns the current scope of the transport base.

func (*InternalTransport) Send

func (t *InternalTransport) Send(lpPkt *spec.LpPacket)

Send sends a packet from the perspective of the internal component.

func (*InternalTransport) SetMTU

func (t *InternalTransport) SetMTU(mtu int)

Sets the Maximum Transmission Unit (MTU) for the transport, specifying the maximum size of data packets that can be transmitted.

func (*InternalTransport) SetPersistency

func (t *InternalTransport) SetPersistency(persistency spec_mgmt.Persistency) bool

SetPersistency changes the persistency of the face.

func (*InternalTransport) String

func (t *InternalTransport) String() string

Returns a string representation of the internal transport, including its face ID, remote URI, and local URI.

type LinkService

type LinkService interface {
	String() string
	Transport() transport
	SetFaceID(faceID uint64)

	FaceID() uint64
	LocalURI() *defn.URI
	RemoteURI() *defn.URI
	Persistency() spec_mgmt.Persistency
	SetPersistency(persistency spec_mgmt.Persistency)
	Scope() defn.Scope
	LinkType() defn.LinkType
	MTU() int
	SetMTU(mtu int)

	ExpirationPeriod() time.Duration
	State() defn.State

	// Run is the main entry point for running face thread
	// initial is optional new incoming frame
	Run(initial []byte)

	// Add a packet to the send queue for this link service
	SendPacket(out dispatch.OutPkt)

	// Close the face
	Close()

	// Counters
	NInInterests() uint64
	NInData() uint64
	NInBytes() uint64
	NOutInterests() uint64
	NOutData() uint64
	NOutBytes() uint64
	// contains filtered or unexported methods
}

LinkService is an interface for link service implementations

type Listener

type Listener interface {
	String() string
	Run()
	Close()
}

Listener listens for incoming unicast connections for a transport type.

type MulticastUDPTransport

type MulticastUDPTransport struct {
	// contains filtered or unexported fields
}

MulticastUDPTransport is a multicast UDP transport.

func MakeMulticastUDPTransport

func MakeMulticastUDPTransport(localURI *defn.URI) (*MulticastUDPTransport, error)

MakeMulticastUDPTransport creates a new multicast UDP transport.

func (*MulticastUDPTransport) Close

func (t *MulticastUDPTransport) Close()

Closes the transport's send and receive connections if the transport is running, ensuring idempotent behavior by atomically checking and updating the running state.

func (*MulticastUDPTransport) ExpirationPeriod

func (t *MulticastUDPTransport) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until this face expires. If transport not on-demand, returns 0.

func (*MulticastUDPTransport) FaceID

func (t *MulticastUDPTransport) FaceID() uint64

Returns the unique identifier of the face associated with this transport.

func (*MulticastUDPTransport) GetSendQueueSize

func (t *MulticastUDPTransport) GetSendQueueSize() uint64

Returns the current size of the send queue on the transport's socket by retrieving low-level socket information via a system call.

func (*MulticastUDPTransport) IsRunning

func (t *MulticastUDPTransport) IsRunning() bool

Returns whether the transport is currently running.

func (*MulticastUDPTransport) LinkType

func (t *MulticastUDPTransport) LinkType() defn.LinkType

Returns the link type of the transport as a `defn.LinkType` value.

func (*MulticastUDPTransport) LocalURI

func (t *MulticastUDPTransport) LocalURI() *defn.URI

Returns the local URI associated with the transport instance.

func (*MulticastUDPTransport) MTU

func (t *MulticastUDPTransport) MTU() int

Returns the maximum transmission unit (MTU) size for the transport.

func (*MulticastUDPTransport) NInBytes

func (t *MulticastUDPTransport) NInBytes() uint64

Returns the total number of bytes received by the transport.

func (*MulticastUDPTransport) NOutBytes

func (t *MulticastUDPTransport) NOutBytes() uint64

Returns the total number of bytes transmitted by this transport as a 64-bit unsigned integer.

func (*MulticastUDPTransport) Persistency

func (t *MulticastUDPTransport) Persistency() spec_mgmt.Persistency

Returns the persistency setting of the transport.

func (*MulticastUDPTransport) RemoteURI

func (t *MulticastUDPTransport) RemoteURI() *defn.URI

Returns the remote URI associated with the transport connection.

func (*MulticastUDPTransport) Scope

func (t *MulticastUDPTransport) Scope() defn.Scope

Returns the current scope of the transport base.

func (*MulticastUDPTransport) SetMTU

func (t *MulticastUDPTransport) SetMTU(mtu int)

Sets the Maximum Transmission Unit (MTU) for the transport, specifying the maximum size of data packets that can be transmitted.

func (*MulticastUDPTransport) SetPersistency

func (t *MulticastUDPTransport) SetPersistency(persistency spec_mgmt.Persistency) bool

Sets the transport's persistency to Permanent, returning true if the persistency was updated or already set to Permanent, otherwise false.

func (*MulticastUDPTransport) String

func (t *MulticastUDPTransport) String() string

Returns a string representation of the MulticastUDPTransport, including its face ID, remote URI, and local URI, typically used for debugging or logging.

type NDNLPLinkService

type NDNLPLinkService struct {
	// contains filtered or unexported fields
}

NDNLPLinkService is a link service implementing the NDNLPv2 link protocol

func MakeNDNLPLinkService

func MakeNDNLPLinkService(transport transport, options NDNLPLinkServiceOptions) *NDNLPLinkService

MakeNDNLPLinkService creates a new NDNLPv2 link service

func (*NDNLPLinkService) Close

func (l *NDNLPLinkService) Close()

Close the underlying transport

func (*NDNLPLinkService) ExpirationPeriod

func (l *NDNLPLinkService) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until the underlying transport expires. If transport not on-demand, returns 0.

func (*NDNLPLinkService) FaceID

func (l *NDNLPLinkService) FaceID() uint64

FaceID returns the ID of the face

func (*NDNLPLinkService) LinkType

func (l *NDNLPLinkService) LinkType() defn.LinkType

LinkType returns the type of the link.

func (*NDNLPLinkService) LocalURI

func (l *NDNLPLinkService) LocalURI() *defn.URI

LocalURI returns the local URI of the underlying transport

func (*NDNLPLinkService) MTU

func (l *NDNLPLinkService) MTU() int

MTU returns the MTU of the underlying transport.

func (*NDNLPLinkService) NInBytes

func (l *NDNLPLinkService) NInBytes() uint64

NInBytes returns the number of link-layer bytes received on this face.

func (*NDNLPLinkService) NInData

func (l *NDNLPLinkService) NInData() uint64

NInData returns the number of Data packets received on this face.

func (*NDNLPLinkService) NInInterests

func (l *NDNLPLinkService) NInInterests() uint64

NInInterests returns the number of Interests received on this face.

func (*NDNLPLinkService) NOutBytes

func (l *NDNLPLinkService) NOutBytes() uint64

NOutBytes returns the number of link-layer bytes sent on this face.

func (*NDNLPLinkService) NOutData

func (l *NDNLPLinkService) NOutData() uint64

NInData returns the number of Data packets sent on this face.

func (*NDNLPLinkService) NOutInterests

func (l *NDNLPLinkService) NOutInterests() uint64

NOutInterests returns the number of Interests sent on this face.

func (*NDNLPLinkService) Options

Options gets the settings of the NDNLPLinkService.

func (*NDNLPLinkService) Persistency

func (l *NDNLPLinkService) Persistency() spec_mgmt.Persistency

Persistency returns the MTU of the underlying transport.

func (*NDNLPLinkService) RemoteURI

func (l *NDNLPLinkService) RemoteURI() *defn.URI

RemoteURI returns the remote URI of the underlying transport

func (*NDNLPLinkService) Run

func (l *NDNLPLinkService) Run(initial []byte)

Run starts the face and associated goroutines

func (*NDNLPLinkService) Scope

func (l *NDNLPLinkService) Scope() defn.Scope

Scope returns the scope of the underlying transport.

func (*NDNLPLinkService) SendPacket

func (l *NDNLPLinkService) SendPacket(out dispatch.OutPkt)

SendPacket adds a packet to the send queue for this link service

func (*NDNLPLinkService) SetFaceID

func (l *NDNLPLinkService) SetFaceID(faceID uint64)

Sets the FaceID for the link service and its underlying transport if present.

func (*NDNLPLinkService) SetMTU

func (l *NDNLPLinkService) SetMTU(mtu int)

SetMTU sets the MTU of the underlying transport.

func (*NDNLPLinkService) SetOptions

func (l *NDNLPLinkService) SetOptions(options NDNLPLinkServiceOptions)

SetOptions changes the settings of the NDNLPLinkService.

func (*NDNLPLinkService) SetPersistency

func (l *NDNLPLinkService) SetPersistency(persistency spec_mgmt.Persistency)

SetPersistency sets the MTU of the underlying transport.

func (*NDNLPLinkService) State

func (l *NDNLPLinkService) State() defn.State

State returns the state of the underlying transport.

func (*NDNLPLinkService) String

func (l *NDNLPLinkService) String() string

Returns a string representation of the link service, including the transport name if available or the face ID otherwise.

func (*NDNLPLinkService) Transport

func (l *NDNLPLinkService) Transport() transport

Transport returns the transport for the face.

type NDNLPLinkServiceOptions

type NDNLPLinkServiceOptions struct {
	IsFragmentationEnabled bool
	IsReassemblyEnabled    bool

	IsConsumerControlledForwardingEnabled bool

	IsIncomingFaceIndicationEnabled bool

	IsLocalCachePolicyEnabled bool

	IsCongestionMarkingEnabled bool

	BaseCongestionMarkingInterval   time.Duration
	DefaultCongestionThresholdBytes uint64
}

NDNLPLinkServiceOptions contains the settings for an NDNLPLinkService.

func MakeNDNLPLinkServiceOptions

func MakeNDNLPLinkServiceOptions() NDNLPLinkServiceOptions

Constructs an NDNLPLinkServiceOptions with a 100ms base congestion marking interval, 65536-byte default congestion threshold, and enables packet reassembly and fragmentation.

func (*NDNLPLinkServiceOptions) Flags

func (op *NDNLPLinkServiceOptions) Flags() (ret uint64)

Constructs a bitmask of face flags indicating whether consumer-controlled forwarding and congestion marking are enabled in the link service options.

type NullLinkService

type NullLinkService struct {
	// contains filtered or unexported fields
}

NullLinkService is a link service that drops all packets.

func MakeNullLinkService

func MakeNullLinkService(transport transport) *NullLinkService

MakeNullLinkService makes a NullLinkService.

func (*NullLinkService) Close

func (l *NullLinkService) Close()

Close the underlying transport

func (*NullLinkService) ExpirationPeriod

func (l *NullLinkService) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until the underlying transport expires. If transport not on-demand, returns 0.

func (*NullLinkService) FaceID

func (l *NullLinkService) FaceID() uint64

FaceID returns the ID of the face

func (*NullLinkService) LinkType

func (l *NullLinkService) LinkType() defn.LinkType

LinkType returns the type of the link.

func (*NullLinkService) LocalURI

func (l *NullLinkService) LocalURI() *defn.URI

LocalURI returns the local URI of the underlying transport

func (*NullLinkService) MTU

func (l *NullLinkService) MTU() int

MTU returns the MTU of the underlying transport.

func (*NullLinkService) NInBytes

func (l *NullLinkService) NInBytes() uint64

NInBytes returns the number of link-layer bytes received on this face.

func (*NullLinkService) NInData

func (l *NullLinkService) NInData() uint64

NInData returns the number of Data packets received on this face.

func (*NullLinkService) NInInterests

func (l *NullLinkService) NInInterests() uint64

NInInterests returns the number of Interests received on this face.

func (*NullLinkService) NOutBytes

func (l *NullLinkService) NOutBytes() uint64

NOutBytes returns the number of link-layer bytes sent on this face.

func (*NullLinkService) NOutData

func (l *NullLinkService) NOutData() uint64

NInData returns the number of Data packets sent on this face.

func (*NullLinkService) NOutInterests

func (l *NullLinkService) NOutInterests() uint64

NOutInterests returns the number of Interests sent on this face.

func (*NullLinkService) Persistency

func (l *NullLinkService) Persistency() spec_mgmt.Persistency

Persistency returns the MTU of the underlying transport.

func (*NullLinkService) RemoteURI

func (l *NullLinkService) RemoteURI() *defn.URI

RemoteURI returns the remote URI of the underlying transport

func (*NullLinkService) Run

func (l *NullLinkService) Run(initial []byte)

Run runs the NullLinkService.

func (*NullLinkService) Scope

func (l *NullLinkService) Scope() defn.Scope

Scope returns the scope of the underlying transport.

func (*NullLinkService) SendPacket

func (l *NullLinkService) SendPacket(out dispatch.OutPkt)

SendPacket adds a packet to the send queue for this link service

func (*NullLinkService) SetFaceID

func (l *NullLinkService) SetFaceID(faceID uint64)

Sets the FaceID for the link service and its underlying transport if present.

func (*NullLinkService) SetMTU

func (l *NullLinkService) SetMTU(mtu int)

SetMTU sets the MTU of the underlying transport.

func (*NullLinkService) SetPersistency

func (l *NullLinkService) SetPersistency(persistency spec_mgmt.Persistency)

SetPersistency sets the MTU of the underlying transport.

func (*NullLinkService) State

func (l *NullLinkService) State() defn.State

State returns the state of the underlying transport.

func (*NullLinkService) String

func (l *NullLinkService) String() string

Returns a string representation of the link service, including the transport name if available or the face ID otherwise.

func (*NullLinkService) Transport

func (l *NullLinkService) Transport() transport

Transport returns the transport for the face.

type NullTransport

type NullTransport struct {
	// contains filtered or unexported fields
}

NullTransport is a transport that drops all packets.

func MakeNullTransport

func MakeNullTransport() *NullTransport

MakeNullTransport makes a NullTransport.

func (*NullTransport) Close

func (t *NullTransport) Close()

Closes the NullTransport by stopping its operation and signaling any active goroutines to terminate if it was running.

func (*NullTransport) ExpirationPeriod

func (t *NullTransport) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until this face expires. If transport not on-demand, returns 0.

func (*NullTransport) FaceID

func (t *NullTransport) FaceID() uint64

Returns the unique identifier of the face associated with this transport.

func (*NullTransport) GetSendQueueSize

func (t *NullTransport) GetSendQueueSize() uint64

GetSendQueueSize returns the current size of the send queue.

func (*NullTransport) IsRunning

func (t *NullTransport) IsRunning() bool

Returns whether the transport is currently running.

func (*NullTransport) LinkType

func (t *NullTransport) LinkType() defn.LinkType

Returns the link type of the transport as a `defn.LinkType` value.

func (*NullTransport) LocalURI

func (t *NullTransport) LocalURI() *defn.URI

Returns the local URI associated with the transport instance.

func (*NullTransport) MTU

func (t *NullTransport) MTU() int

Returns the maximum transmission unit (MTU) size for the transport.

func (*NullTransport) NInBytes

func (t *NullTransport) NInBytes() uint64

Returns the total number of bytes received by the transport.

func (*NullTransport) NOutBytes

func (t *NullTransport) NOutBytes() uint64

Returns the total number of bytes transmitted by this transport as a 64-bit unsigned integer.

func (*NullTransport) Persistency

func (t *NullTransport) Persistency() spec_mgmt.Persistency

Returns the persistency setting of the transport.

func (*NullTransport) RemoteURI

func (t *NullTransport) RemoteURI() *defn.URI

Returns the remote URI associated with the transport connection.

func (*NullTransport) Scope

func (t *NullTransport) Scope() defn.Scope

Returns the current scope of the transport base.

func (*NullTransport) SetMTU

func (t *NullTransport) SetMTU(mtu int)

Sets the Maximum Transmission Unit (MTU) for the transport, specifying the maximum size of data packets that can be transmitted.

func (*NullTransport) SetPersistency

func (t *NullTransport) SetPersistency(persistency spec_mgmt.Persistency) bool

SetPersistency changes the persistency of the face.

func (*NullTransport) String

func (t *NullTransport) String() string

Returns a string representation of the NullTransport object including its face ID, remote URI, and local URI.

type TCPListener

type TCPListener struct {
	// contains filtered or unexported fields
}

TCPListener listens for incoming TCP unicast connections.

func MakeTCPListener

func MakeTCPListener(localURI *defn.URI) (*TCPListener, error)

MakeTCPListener constructs a TCPListener.

func (*TCPListener) Close

func (l *TCPListener) Close()

Closes the underlying TCP connection and waits for the listener to fully terminate by blocking until the `stopped` channel receives a signal.

func (*TCPListener) Run

func (l *TCPListener) Run()

This function runs a TCP listener that accepts incoming connections, establishes unicast TCP transports, and initializes NDN link services for each connection to handle Named Data Networking communication.

func (*TCPListener) String

func (l *TCPListener) String() string

Returns a string representation of the TCPListener in the format "tcp-listener (localURI)", where localURI is the listener's bound endpoint.

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table hold all faces used by the forwarder.

var FaceTable Table

FaceTable is the global face table for this forwarder

func (*Table) Add

func (t *Table) Add(face LinkService)

Add adds a face to the face table.

func (*Table) Get

func (t *Table) Get(id uint64) LinkService

Get gets the face with the specified ID (if any) from the face table.

func (*Table) GetAll

func (t *Table) GetAll() []LinkService

GetAll returns points to all faces.

func (*Table) GetByURI

func (t *Table) GetByURI(remoteURI *defn.URI) LinkService

GetByURI gets the face with the specified remote URI (if any) from the face table.

func (*Table) Remove

func (t *Table) Remove(id uint64)

Remove removes a face from the face table.

func (*Table) String

func (t *Table) String() string

Returns a string representation of the Table, which is 'face-table'.

type UDPListener

type UDPListener struct {
	// contains filtered or unexported fields
}

UDPListener listens for incoming UDP unicast connections.

func MakeUDPListener

func MakeUDPListener(localURI *defn.URI) (*UDPListener, error)

MakeUDPListener constructs a UDPListener.

func (*UDPListener) Close

func (l *UDPListener) Close()

Closes the UDP connection and waits for the listener to fully stop, ensuring all background operations complete before returning.

func (*UDPListener) Run

func (l *UDPListener) Run()

Run starts the UDP listener.

func (*UDPListener) String

func (l *UDPListener) String() string

Returns a string representation of the UDP listener, including its local URI.

type UnicastTCPTransport

type UnicastTCPTransport struct {
	// contains filtered or unexported fields
}

UnicastTCPTransport is a unicast TCP transport.

func AcceptUnicastTCPTransport

func AcceptUnicastTCPTransport(
	remoteConn net.Conn,
	localURI *defn.URI,
	persistency spec_mgmt.Persistency,
) (*UnicastTCPTransport, error)

Accept an incoming unicast TCP transport.

func MakeUnicastTCPTransport

func MakeUnicastTCPTransport(
	remoteURI *defn.URI,
	localURI *defn.URI,
	persistency spec_mgmt.Persistency,
) (*UnicastTCPTransport, error)

Makes an outgoing unicast TCP transport.

func (*UnicastTCPTransport) Close

func (t *UnicastTCPTransport) Close()

Close the connection permanently - this will not attempt to reconnect.

func (*UnicastTCPTransport) CloseConn

func (t *UnicastTCPTransport) CloseConn()

Close the inner connection if running without closing the transport.

func (*UnicastTCPTransport) ExpirationPeriod

func (t *UnicastTCPTransport) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until this face expires. If transport not on-demand, returns 0.

func (*UnicastTCPTransport) FaceID

func (t *UnicastTCPTransport) FaceID() uint64

Returns the unique identifier of the face associated with this transport.

func (*UnicastTCPTransport) GetSendQueueSize

func (t *UnicastTCPTransport) GetSendQueueSize() uint64

Returns the current size of the TCP send queue for this connection using a system call, logging a warning if unable to access the raw socket.

func (*UnicastTCPTransport) IsRunning

func (t *UnicastTCPTransport) IsRunning() bool

Returns whether the transport is currently running.

func (*UnicastTCPTransport) LinkType

func (t *UnicastTCPTransport) LinkType() defn.LinkType

Returns the link type of the transport as a `defn.LinkType` value.

func (*UnicastTCPTransport) LocalURI

func (t *UnicastTCPTransport) LocalURI() *defn.URI

Returns the local URI associated with the transport instance.

func (*UnicastTCPTransport) MTU

func (t *UnicastTCPTransport) MTU() int

Returns the maximum transmission unit (MTU) size for the transport.

func (*UnicastTCPTransport) NInBytes

func (t *UnicastTCPTransport) NInBytes() uint64

Returns the total number of bytes received by the transport.

func (*UnicastTCPTransport) NOutBytes

func (t *UnicastTCPTransport) NOutBytes() uint64

Returns the total number of bytes transmitted by this transport as a 64-bit unsigned integer.

func (*UnicastTCPTransport) Persistency

func (t *UnicastTCPTransport) Persistency() spec_mgmt.Persistency

Returns the persistency setting of the transport.

func (*UnicastTCPTransport) RemoteURI

func (t *UnicastTCPTransport) RemoteURI() *defn.URI

Returns the remote URI associated with the transport connection.

func (*UnicastTCPTransport) Scope

func (t *UnicastTCPTransport) Scope() defn.Scope

Returns the current scope of the transport base.

func (*UnicastTCPTransport) SetMTU

func (t *UnicastTCPTransport) SetMTU(mtu int)

Sets the Maximum Transmission Unit (MTU) for the transport, specifying the maximum size of data packets that can be transmitted.

func (*UnicastTCPTransport) SetPersistency

func (t *UnicastTCPTransport) SetPersistency(persistency spec_mgmt.Persistency) bool

Sets the persistency level of the UnicastTCPTransport to the specified value.

func (*UnicastTCPTransport) String

func (t *UnicastTCPTransport) String() string

Returns a string representation of the UnicastTCPTransport, including its face ID, remote URI, and local URI for identification and debugging.

type UnicastUDPTransport

type UnicastUDPTransport struct {
	// contains filtered or unexported fields
}

UnicastUDPTransport is a unicast UDP transport.

func MakeUnicastUDPTransport

func MakeUnicastUDPTransport(
	remoteURI *defn.URI,
	localURI *defn.URI,
	persistency spec_mgmt.Persistency,
) (*UnicastUDPTransport, error)

MakeUnicastUDPTransport creates a new unicast UDP transport.

func (*UnicastUDPTransport) Close

func (t *UnicastUDPTransport) Close()

Closes the transport's UDP connection and atomically marks the transport as stopped, ensuring the operation occurs only if the transport was previously running.

func (*UnicastUDPTransport) ExpirationPeriod

func (t *UnicastUDPTransport) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until this face expires. If transport not on-demand, returns 0.

func (*UnicastUDPTransport) FaceID

func (t *UnicastUDPTransport) FaceID() uint64

Returns the unique identifier of the face associated with this transport.

func (*UnicastUDPTransport) GetSendQueueSize

func (t *UnicastUDPTransport) GetSendQueueSize() uint64

Returns the current size of the send queue for the UDP socket, using a system call to retrieve the socket's queued data size and logging any errors encountered during the process.

func (*UnicastUDPTransport) IsRunning

func (t *UnicastUDPTransport) IsRunning() bool

Returns whether the transport is currently running.

func (*UnicastUDPTransport) LinkType

func (t *UnicastUDPTransport) LinkType() defn.LinkType

Returns the link type of the transport as a `defn.LinkType` value.

func (*UnicastUDPTransport) LocalURI

func (t *UnicastUDPTransport) LocalURI() *defn.URI

Returns the local URI associated with the transport instance.

func (*UnicastUDPTransport) MTU

func (t *UnicastUDPTransport) MTU() int

Returns the maximum transmission unit (MTU) size for the transport.

func (*UnicastUDPTransport) NInBytes

func (t *UnicastUDPTransport) NInBytes() uint64

Returns the total number of bytes received by the transport.

func (*UnicastUDPTransport) NOutBytes

func (t *UnicastUDPTransport) NOutBytes() uint64

Returns the total number of bytes transmitted by this transport as a 64-bit unsigned integer.

func (*UnicastUDPTransport) Persistency

func (t *UnicastUDPTransport) Persistency() spec_mgmt.Persistency

Returns the persistency setting of the transport.

func (*UnicastUDPTransport) RemoteURI

func (t *UnicastUDPTransport) RemoteURI() *defn.URI

Returns the remote URI associated with the transport connection.

func (*UnicastUDPTransport) Scope

func (t *UnicastUDPTransport) Scope() defn.Scope

Returns the current scope of the transport base.

func (*UnicastUDPTransport) SetMTU

func (t *UnicastUDPTransport) SetMTU(mtu int)

Sets the Maximum Transmission Unit (MTU) for the transport, specifying the maximum size of data packets that can be transmitted.

func (*UnicastUDPTransport) SetPersistency

func (t *UnicastUDPTransport) SetPersistency(persistency spec_mgmt.Persistency) bool

Sets the persistency level of the UnicastUDPTransport to the specified value.

func (*UnicastUDPTransport) String

func (t *UnicastUDPTransport) String() string

Returns a string representation of the UnicastUDPTransport containing its face ID, remote URI, and local URI in the format "unicast-udp-transport (face=ID remote=ADDR local=ADDR)".

type UnixStreamListener

type UnixStreamListener struct {
	// contains filtered or unexported fields
}

UnixStreamListener listens for incoming Unix stream connections.

func MakeUnixStreamListener

func MakeUnixStreamListener(localURI *defn.URI) (*UnixStreamListener, error)

MakeUnixStreamListener constructs a UnixStreamListener.

func (*UnixStreamListener) Close

func (l *UnixStreamListener) Close()

Closes the Unix stream connection and waits for the listener to fully stop by receiving on the stopped channel.

func (*UnixStreamListener) Run

func (l *UnixStreamListener) Run()

Starts a Unix domain socket listener, accepts incoming connections, creates Unix stream transports for each connection, and initializes NDNP link services with reliable stream options for local communication.

func (*UnixStreamListener) String

func (l *UnixStreamListener) String() string

Returns a string representation of the UnixStreamListener including its local URI.

type UnixStreamTransport

type UnixStreamTransport struct {
	// contains filtered or unexported fields
}

UnixStreamTransport is a Unix stream transport for communicating with local applications.

func MakeUnixStreamTransport

func MakeUnixStreamTransport(remoteURI *defn.URI, localURI *defn.URI, conn net.Conn) (*UnixStreamTransport, error)

MakeUnixStreamTransport creates a Unix stream transport.

func (*UnixStreamTransport) Close

func (t *UnixStreamTransport) Close()

Closes the Unix stream transport, closing the underlying connection only if the transport was previously running, and ensuring it cannot be reused.

func (*UnixStreamTransport) ExpirationPeriod

func (t *UnixStreamTransport) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until this face expires. If transport not on-demand, returns 0.

func (*UnixStreamTransport) FaceID

func (t *UnixStreamTransport) FaceID() uint64

Returns the unique identifier of the face associated with this transport.

func (*UnixStreamTransport) GetSendQueueSize

func (t *UnixStreamTransport) GetSendQueueSize() uint64

GetSendQueueSize returns the current size of the send queue.

func (*UnixStreamTransport) IsRunning

func (t *UnixStreamTransport) IsRunning() bool

Returns whether the transport is currently running.

func (*UnixStreamTransport) LinkType

func (t *UnixStreamTransport) LinkType() defn.LinkType

Returns the link type of the transport as a `defn.LinkType` value.

func (*UnixStreamTransport) LocalURI

func (t *UnixStreamTransport) LocalURI() *defn.URI

Returns the local URI associated with the transport instance.

func (*UnixStreamTransport) MTU

func (t *UnixStreamTransport) MTU() int

Returns the maximum transmission unit (MTU) size for the transport.

func (*UnixStreamTransport) NInBytes

func (t *UnixStreamTransport) NInBytes() uint64

Returns the total number of bytes received by the transport.

func (*UnixStreamTransport) NOutBytes

func (t *UnixStreamTransport) NOutBytes() uint64

Returns the total number of bytes transmitted by this transport as a 64-bit unsigned integer.

func (*UnixStreamTransport) Persistency

func (t *UnixStreamTransport) Persistency() spec_mgmt.Persistency

Returns the persistency setting of the transport.

func (*UnixStreamTransport) RemoteURI

func (t *UnixStreamTransport) RemoteURI() *defn.URI

Returns the remote URI associated with the transport connection.

func (*UnixStreamTransport) Scope

func (t *UnixStreamTransport) Scope() defn.Scope

Returns the current scope of the transport base.

func (*UnixStreamTransport) SetMTU

func (t *UnixStreamTransport) SetMTU(mtu int)

Sets the Maximum Transmission Unit (MTU) for the transport, specifying the maximum size of data packets that can be transmitted.

func (*UnixStreamTransport) SetPersistency

func (t *UnixStreamTransport) SetPersistency(persistency spec_mgmt.Persistency) bool

SetPersistency changes the persistency of the face.

func (*UnixStreamTransport) String

func (t *UnixStreamTransport) String() string

Returns a string representation of the Unix stream transport including its face ID, remote URI, and local URI.

type WebSocketListener

type WebSocketListener struct {
	// contains filtered or unexported fields
}

WebSocketListener listens for incoming WebSockets connections.

func NewWebSocketListener

func NewWebSocketListener(cfg WebSocketListenerConfig) (*WebSocketListener, error)

Constructs a WebSocket listener configured with the provided settings, including TLS support if enabled, and initializes the server with the appropriate URI, upgrader, and security parameters.

func (*WebSocketListener) Close

func (l *WebSocketListener) Close()

Closes the WebSocket listener by initiating a graceful shutdown of the underlying server.

func (*WebSocketListener) Run

func (l *WebSocketListener) Run()

Starts the WebSocket server using HTTP or HTTPS based on TLS configuration, logging a fatal error if startup fails.

func (*WebSocketListener) String

func (l *WebSocketListener) String() string

Returns a string representation of the WebSocketListener, including its local URI.

type WebSocketListenerConfig

type WebSocketListenerConfig struct {
	Bind       string
	Port       uint16
	TLSEnabled bool
	TLSCert    string
	TLSKey     string
}

WebSocketListenerConfig contains WebSocketListener configuration.

func (WebSocketListenerConfig) String

func (cfg WebSocketListenerConfig) String() string

Returns a string representation of the WebSocket listener configuration, including its URL and TLS certificate path.

func (WebSocketListenerConfig) URL

func (cfg WebSocketListenerConfig) URL() *url.URL

Constructs a WebSocket URL (ws or wss) using the configuration's bind address, port, and TLS setting.

type WebSocketTransport

type WebSocketTransport struct {
	// contains filtered or unexported fields
}

WebSocketTransport communicates with web applications via WebSocket.

func NewWebSocketTransport

func NewWebSocketTransport(localURI *defn.URI, c *websocket.Conn) (t *WebSocketTransport)

Constructs a WebSocket-based transport for Named Data Networking (NDN) communication, initializing remote and local URIs, determining network scope (local or non-local), and configuring transport parameters such as persistency, link kind, and maximum packet size.

func (*WebSocketTransport) Close

func (t *WebSocketTransport) Close()

Closes the WebSocket transport by stopping its operation and terminating the underlying WebSocket connection.

func (*WebSocketTransport) ExpirationPeriod

func (t *WebSocketTransport) ExpirationPeriod() time.Duration

ExpirationPeriod returns the time until this face expires. If transport not on-demand, returns 0.

func (*WebSocketTransport) FaceID

func (t *WebSocketTransport) FaceID() uint64

Returns the unique identifier of the face associated with this transport.

func (*WebSocketTransport) GetSendQueueSize

func (t *WebSocketTransport) GetSendQueueSize() uint64

Returns the number of packets currently in the send queue waiting to be transmitted over the WebSocket connection.

func (*WebSocketTransport) IsRunning

func (t *WebSocketTransport) IsRunning() bool

Returns whether the transport is currently running.

func (*WebSocketTransport) LinkType

func (t *WebSocketTransport) LinkType() defn.LinkType

Returns the link type of the transport as a `defn.LinkType` value.

func (*WebSocketTransport) LocalURI

func (t *WebSocketTransport) LocalURI() *defn.URI

Returns the local URI associated with the transport instance.

func (*WebSocketTransport) MTU

func (t *WebSocketTransport) MTU() int

Returns the maximum transmission unit (MTU) size for the transport.

func (*WebSocketTransport) NInBytes

func (t *WebSocketTransport) NInBytes() uint64

Returns the total number of bytes received by the transport.

func (*WebSocketTransport) NOutBytes

func (t *WebSocketTransport) NOutBytes() uint64

Returns the total number of bytes transmitted by this transport as a 64-bit unsigned integer.

func (*WebSocketTransport) Persistency

func (t *WebSocketTransport) Persistency() spec_mgmt.Persistency

Returns the persistency setting of the transport.

func (*WebSocketTransport) RemoteURI

func (t *WebSocketTransport) RemoteURI() *defn.URI

Returns the remote URI associated with the transport connection.

func (*WebSocketTransport) Scope

func (t *WebSocketTransport) Scope() defn.Scope

Returns the current scope of the transport base.

func (*WebSocketTransport) SetMTU

func (t *WebSocketTransport) SetMTU(mtu int)

Sets the Maximum Transmission Unit (MTU) for the transport, specifying the maximum size of data packets that can be transmitted.

func (*WebSocketTransport) SetPersistency

func (t *WebSocketTransport) SetPersistency(persistency spec_mgmt.Persistency) bool

Returns true if the persistency is set to PersistencyOnDemand, otherwise false.

func (*WebSocketTransport) String

func (t *WebSocketTransport) String() string

Returns a string representation of the WebSocket transport including its face ID, remote URI, and local URI.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL