udp

package
v0.30.6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigID = ControllerID

ConfigID is the string used to identify this config object.

View Source
const ControllerID = "bifrost/udp"

ControllerID is the UDP controller ID.

View Source
const TransportType = "udp"

TransportType is the transport type identifier.

Variables

View Source
var ExtendedSockBuf = 16777217

ExtendedSockBuf is the sockbuf parameter to set on udp sockets.

View Source
var Version = semver.MustParse("0.0.1")

Version is the version of the udp implementation.

Functions

This section is empty.

Types

type Config

type Config struct {

	// TransportPeerID sets the peer ID to attach the transport to.
	// If unset, attaches to any running peer with a private key.
	TransportPeerId string `protobuf:"bytes,1,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transportPeerId,omitempty"`
	// ListenAddr contains the address to listen on.
	// Has no effect in the browser.
	ListenAddr string `protobuf:"bytes,2,opt,name=listen_addr,json=listenAddr,proto3" json:"listenAddr,omitempty"`
	// PacketOpts are options to set on the packet connection.
	PacketOpts *pconn.Opts `protobuf:"bytes,4,opt,name=packet_opts,json=packetOpts,proto3" json:"packetOpts,omitempty"`
	// Dialers maps peer IDs to dialers.
	Dialers map[string]*dialer.DialerOpts `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

Config is the configuration for the udp transport.

func (*Config) CloneMessageVT added in v0.15.6

func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Config) CloneVT added in v0.8.3

func (m *Config) CloneVT() *Config

func (*Config) EqualMessageVT added in v0.15.6

func (this *Config) EqualMessageVT(thatMsg any) bool

func (*Config) EqualVT added in v0.3.0

func (this *Config) EqualVT(that *Config) bool

func (*Config) EqualsConfig

func (c *Config) EqualsConfig(c2 config.Config) bool

EqualsConfig checks if the other config is equal.

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type. This string is stored with the encoded config.

func (*Config) GetDebugVals

func (c *Config) GetDebugVals() config.DebugValues

GetDebugVals returns the directive arguments as key/value pairs. This should be something like param1="test", param2="test". This is not necessarily unique, and is primarily intended for display.

func (*Config) GetDialers

func (x *Config) GetDialers() map[string]*dialer.DialerOpts

func (*Config) GetListenAddr

func (x *Config) GetListenAddr() string

func (*Config) GetPacketOpts

func (x *Config) GetPacketOpts() *pconn.Opts

func (*Config) GetTransportPeerId

func (x *Config) GetTransportPeerId() string

func (*Config) MarshalJSON added in v0.29.0

func (x *Config) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Config to JSON.

func (*Config) MarshalProtoJSON added in v0.29.0

func (x *Config) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Config message to JSON.

func (*Config) MarshalProtoText added in v0.29.2

func (x *Config) MarshalProtoText() string

func (*Config) MarshalToSizedBufferVT added in v0.2.0

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT added in v0.2.0

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT added in v0.2.0

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ParseTransportPeerID added in v0.20.0

func (c *Config) ParseTransportPeerID() (peer.ID, error)

ParseTransportPeerID parses the node peer ID if it is not empty.

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SetTransportPeerId

func (c *Config) SetTransportPeerId(peerID string)

SetTransportPeerId sets the node peer ID field.

func (*Config) SizeVT added in v0.2.0

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalJSON added in v0.29.0

func (x *Config) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Config from JSON.

func (*Config) UnmarshalProtoJSON added in v0.29.0

func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Config message from JSON.

func (*Config) UnmarshalVT added in v0.2.0

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration. This is a cursory validation to see if the values "look correct."

type Config_DialersEntry added in v0.29.0

type Config_DialersEntry struct {
	Key   string             `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value *dialer.DialerOpts `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Config_DialersEntry) GetKey added in v0.29.0

func (x *Config_DialersEntry) GetKey() string

func (*Config_DialersEntry) GetValue added in v0.29.0

func (x *Config_DialersEntry) GetValue() *dialer.DialerOpts

func (*Config_DialersEntry) MarshalJSON added in v0.29.0

func (x *Config_DialersEntry) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Config_DialersEntry to JSON.

func (*Config_DialersEntry) MarshalProtoJSON added in v0.29.0

func (x *Config_DialersEntry) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Config_DialersEntry message to JSON.

func (*Config_DialersEntry) MarshalProtoText added in v0.29.2

func (x *Config_DialersEntry) MarshalProtoText() string

func (*Config_DialersEntry) ProtoMessage added in v0.29.0

func (*Config_DialersEntry) ProtoMessage()

func (*Config_DialersEntry) Reset added in v0.29.0

func (x *Config_DialersEntry) Reset()

func (*Config_DialersEntry) String added in v0.29.2

func (x *Config_DialersEntry) String() string

func (*Config_DialersEntry) UnmarshalJSON added in v0.29.0

func (x *Config_DialersEntry) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Config_DialersEntry from JSON.

func (*Config_DialersEntry) UnmarshalProtoJSON added in v0.29.0

func (x *Config_DialersEntry) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Config_DialersEntry message from JSON.

type Factory

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

Factory constructs a UDP transport.

func NewFactory

func NewFactory(bus bus.Bus) *Factory

NewFactory builds a UDP transport factory.

func (*Factory) Construct

func (t *Factory) Construct(
	ctx context.Context,
	conf config.Config,
	opts controller.ConstructOpts,
) (controller.Controller, error)

Construct constructs the associated controller given configuration.

func (*Factory) ConstructConfig

func (t *Factory) ConstructConfig() config.Config

ConstructConfig constructs an instance of the controller configuration.

func (*Factory) GetConfigID

func (t *Factory) GetConfigID() string

GetConfigID returns the configuration ID for the controller.

func (*Factory) GetControllerID

func (t *Factory) GetControllerID() string

GetControllerID returns the unique ID for the controller.

func (*Factory) GetVersion

func (t *Factory) GetVersion() semver.Version

GetVersion returns the version of this controller.

type Link = pconn.Link

Link represents a UDP-based connection/link.

type UDP

type UDP struct {
	*pconn.Transport
}

UDP implements a UDP transport.

func NewUDP

func NewUDP(
	ctx context.Context,
	le *logrus.Entry,
	pKey crypto.PrivKey,
	c transport.TransportHandler,
	pconnOpts *pconn.Opts,
	uuid uint64,
	listenAddr string,
	staticPeerMap map[string]*dialer.DialerOpts,
) (*UDP, error)

NewUDP builds a new UDP transport, listening on the addr.

uuid can be empty to generate based on peer id and local addr

func (*UDP) MatchTransportType added in v0.14.1

func (u *UDP) MatchTransportType(transportType string) bool

MatchTransportType checks if the given transport type ID matches this transport. If returns true, the transport controller will call DialPeer with that tptaddr. E.x.: "udp-quic" or "ws"

Jump to

Keyboard shortcuts

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