config

package
v0.0.0-...-b22b80b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Transport           string                // which transport to use, e.g. tcp, kcp
	SupportedTransports []transport.Transport // supported transport layers
	Hostname            string                // IP or domain name for remote node to connect to, e.g. 127.0.0.1, nkn.org. Empty string means remote nodes will fill it with your address they saw, which works if all nodes are not in the same local network or are all in the local network, but will cause problem if some nodes are in the same local network
	Port                uint16                // port to listen to incoming connections
	NodeIDBytes         uint32                // length of node id in bytes
	MessageIDBytes      uint8                 // MsgIDBytes is the length of message id in RandBytes

	Multiplexer        string // which multiplexer to use, e.g. smux, yamux
	NumStreamsToOpen   uint32 // number of streams to open per remote node
	NumStreamsToAccept uint32 // number of streams to accept per remote node

	LocalRxMsgChanLen              uint32                 // Max number of msg that can be buffered per routing type
	LocalHandleMsgChanLen          uint32                 // Max number of msg to be processed that can be buffered
	LocalHandleMsgWorkers          uint32                 // Number of concurrent workers handling msg sent to local node
	LocalRxMsgCacheRoutingType     []protobuf.RoutingType // Only message id with these routing types will be cached
	LocalRxMsgCacheExpiration      time.Duration          // How long a received message id stays in cache before expiration
	LocalRxMsgCacheCleanupInterval time.Duration          // How often to check and delete expired received message id

	RemoteRxMsgChanLen              uint32                 // Max number of msg received that can be buffered
	RemoteTxMsgChanLen              uint32                 // Max number of msg to be sent that can be buffered
	RemoteTxMsgCacheRoutingType     []protobuf.RoutingType // Only message id with these routing types will be cached
	RemoteTxMsgCacheExpiration      time.Duration          // How long a sent message id stays in cache before expiration
	RemoteTxMsgCacheCleanupInterval time.Duration          // How often to check and delete expired sent message

	MaxMessageSize               uint32        // Max message size in bytes
	DefaultReplyTimeout          time.Duration // default timeout for receiving reply msg
	ReplyChanCleanupInterval     time.Duration // How often to check and delete expired reply chan
	MeasureRoundTripTimeInterval time.Duration // Time interval between measuring round trip time
	KeepAliveTimeout             time.Duration // Max idle time before considering node dead and closing connection
	DialTimeout                  time.Duration // Transport dial timeout

	OverlayLocalMsgChanLen uint32 // Max number of msg to be processed by local node that can be buffered

	MinNumSuccessors      uint32        // minimal number of successors of each chord node
	NumFingerSuccessors   uint32        // minimal number of successors of each finger table key
	NumSuccessorsFactor   uint32        // number of successors is max(this factor times the number of non empty finger table, MinNumSuccessors)
	BaseStabilizeInterval time.Duration // base stabilize interval
}

Config is the configuration struct

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configurations

func MergedConfig

func MergedConfig(conf *Config) (*Config, error)

MergedConfig returns a new Config that use fields in conf if provided, otherwise use default config

Jump to

Keyboard shortcuts

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