connmanager

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InboundConnectionEventType = "connmanager.inbound-conn"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionManager

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

func NewConnectionManager

func NewConnectionManager(cfg ConnectionManagerConfig) *ConnectionManager

func (*ConnectionManager) AddConnection

func (c *ConnectionManager) AddConnection(conn *ouroboros.Connection)

func (*ConnectionManager) AddHost

func (c *ConnectionManager) AddHost(
	address string,
	port uint,
	tags ...ConnectionManagerTag,
)

func (*ConnectionManager) AddHostsFromTopology

func (c *ConnectionManager) AddHostsFromTopology(
	topologyConfig *topology.TopologyConfig,
)

func (*ConnectionManager) GetConnectionById

func (c *ConnectionManager) GetConnectionById(
	connId ouroboros.ConnectionId,
) *ConnectionManagerConnection

func (*ConnectionManager) GetConnectionsByTags

func (c *ConnectionManager) GetConnectionsByTags(
	tags ...ConnectionManagerTag,
) []*ConnectionManagerConnection

func (*ConnectionManager) RemoveConnection

func (c *ConnectionManager) RemoveConnection(connId ouroboros.ConnectionId)

func (*ConnectionManager) Start added in v0.1.7

func (c *ConnectionManager) Start() error

type ConnectionManagerConfig

type ConnectionManagerConfig struct {
	Logger         *slog.Logger
	EventBus       *event.EventBus
	ConnClosedFunc ConnectionManagerConnClosedFunc
	Listeners      []ListenerConfig
}

type ConnectionManagerConnClosedFunc

type ConnectionManagerConnClosedFunc func(ouroboros.ConnectionId, error)

ConnectionManagerConnClosedFunc is a function that takes a connection ID and an optional error

type ConnectionManagerConnection

type ConnectionManagerConnection struct {
	Conn *ouroboros.Connection
	Tags map[ConnectionManagerTag]bool
}

func (*ConnectionManagerConnection) AddTags

func (*ConnectionManagerConnection) RemoveTags

func (c *ConnectionManagerConnection) RemoveTags(tags ...ConnectionManagerTag)

type ConnectionManagerHost

type ConnectionManagerHost struct {
	Address string
	Port    uint
	Tags    map[ConnectionManagerTag]bool
}

type ConnectionManagerTag

type ConnectionManagerTag uint16

ConnectionManagerTag represents the various tags that can be associated with a host or connection

const (
	ConnectionManagerTagNone ConnectionManagerTag = iota

	ConnectionManagerTagHostLocalRoot
	ConnectionManagerTagHostPublicRoot
	ConnectionManagerTagHostBootstrapPeer
	ConnectionManagerTagHostP2PLedger
	ConnectionManagerTagHostP2PGossip

	ConnectionManagerTagRoleInitiator
	ConnectionManagerTagRoleResponder
)

func (ConnectionManagerTag) String

func (c ConnectionManagerTag) String() string

type InboundConnectionEvent added in v0.1.7

type InboundConnectionEvent struct {
	ConnectionId ouroboros.ConnectionId
	LocalAddr    net.Addr
	RemoteAddr   net.Addr
}

type ListenerConfig added in v0.1.7

type ListenerConfig struct {
	UseNtC         bool
	Listener       net.Listener
	ListenNetwork  string
	ListenAddress  string
	ReuseAddress   bool
	ConnectionOpts []ouroboros.ConnectionOptionFunc
}

Jump to

Keyboard shortcuts

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