vlan

package
v0.0.0-...-0b1a56d Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithNetworkBroadcastAddress

func WithNetworkBroadcastAddress(broadcastAddress *Address) GenericApplier[*Network]

func WithNetworkDropPercent

func WithNetworkDropPercent(dropPercent float32) GenericApplier[*Network]

func WithNetworkName

func WithNetworkName(name string) GenericApplier[*Network]

func WithNetworkTrafficLogger

func WithNetworkTrafficLogger(trafficLogger TrafficLogger) GenericApplier[*Network]

func WithNodeLan

func WithNodeLan(lan NodeNetworkReference) GenericApplier[*Node]

func WithNodeName

func WithNodeName(name string) GenericApplier[*Node]

func WithNodePromiscuous

func WithNodePromiscuous(promiscuous bool) GenericApplier[*Node]

func WithNodeSpoofing

func WithNodeSpoofing(spoofing bool) GenericApplier[*Node]

Types

type IPNetwork

type IPNetwork struct {
	*Network
}

IPNetwork instances are Network objects where the addresses on the

network are tuples that would be used for sockets like ('1.2.3.4', 5).
The first node added to the network sets the broadcast address, like
('1.2.3.255', 5) and the other nodes must have the same tuple.

func NewIPNetwork

func NewIPNetwork(localLog zerolog.Logger, options ...Option) *IPNetwork

func (*IPNetwork) AddNode

func (n *IPNetwork) AddNode(node NetworkNode)

AddNode Add a node to this network, let the node know which network it's on.

type IPNode

type IPNode struct {
	*Node
	// contains filtered or unexported fields
}

An IPNode is a Node where the address is an Address that has an address

tuple and a broadcast tuple that would be used for socket communications.

func NewIPNode

func NewIPNode(localLog zerolog.Logger, addr *Address, lan *IPNetwork, options ...Option) (*IPNode, error)

func (*IPNode) Serialize

func (d *IPNode) Serialize() ([]byte, error)

func (*IPNode) SerializeWithWriteBuffer

func (d *IPNode) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*IPNode) String

func (d *IPNode) String() string

type IPRouter

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

func NewIPRouter

func NewIPRouter(localLog zerolog.Logger) *IPRouter

func (*IPRouter) AddNetwork

func (n *IPRouter) AddNetwork(addr *Address, lan *IPNetwork)

func (*IPRouter) ProcessPDU

func (n *IPRouter) ProcessPDU(node *IPRouterNode, pdu PDU)

func (*IPRouter) String

func (n *IPRouter) String() string

type IPRouterNode

type IPRouterNode struct {
	ClientContract
	// contains filtered or unexported fields
}

func NewIPRouterNode

func NewIPRouterNode(localLog zerolog.Logger, router *IPRouter, addr *Address, lan *IPNetwork, options ...Option) (*IPRouterNode, error)

func (*IPRouterNode) Confirmation

func (n *IPRouterNode) Confirmation(args Args, kwArgs KWArgs) error

func (*IPRouterNode) Format

func (n *IPRouterNode) Format(s fmt.State, v rune)

func (*IPRouterNode) ProcessPDU

func (n *IPRouterNode) ProcessPDU(pdu PDU) error

func (*IPRouterNode) Serialize

func (d *IPRouterNode) Serialize() ([]byte, error)

func (*IPRouterNode) SerializeWithWriteBuffer

func (d *IPRouterNode) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*IPRouterNode) String

func (d *IPRouterNode) String() string

type Network

type Network struct {
	*DefaultRFormatter
	// contains filtered or unexported fields
}

func NewNetwork

func NewNetwork(localLog zerolog.Logger, options ...Option) *Network

func (*Network) AddNode

func (n *Network) AddNode(node NetworkNode)

AddNode Add a node to this network, let the node know which network it's on.

func (*Network) ProcessPDU

func (n *Network) ProcessPDU(pdu PDU) error

ProcessPDU Process a PDU by sending a copy to each node as dictated by the addressing and if a node is promiscuous.

func (*Network) RemoveNode

func (n *Network) RemoveNode(node NetworkNode)

RemoveNode Remove a node from this network.

func (*Network) String

func (n *Network) String() string

type NetworkNode

type NetworkNode interface {
	fmt.Stringer

	Response(args Args, kwArgs KWArgs) error
	// contains filtered or unexported methods
}

type Node

type Node struct {
	ServerContract
	// contains filtered or unexported fields
}

func NewNode

func NewNode(localLog zerolog.Logger, addr *Address, options ...Option) (*Node, error)

func (*Node) AlternateString

func (n *Node) AlternateString() (string, bool)

func (*Node) Format

func (n *Node) Format(s fmt.State, v rune)

func (*Node) Indication

func (n *Node) Indication(args Args, kwArgs KWArgs) error

func (*Node) Serialize

func (d *Node) Serialize() ([]byte, error)

func (*Node) SerializeWithWriteBuffer

func (d *Node) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Node) SetPromiscuous

func (n *Node) SetPromiscuous(promiscuous bool)

func (*Node) SetSpoofing

func (n *Node) SetSpoofing(spoofing bool)

func (*Node) String

func (d *Node) String() string

type NodeNetworkReference

type NodeNetworkReference interface {
	fmt.Stringer
	AddNode(node NetworkNode)
	ProcessPDU(pdu PDU) error
}

NodeNetworkReference allows Network and IPNetwork to be used from Node.

type TrafficLogger

type TrafficLogger interface {
	Call(args Args)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳