confignet

package module
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 62

README

Network Configuration Settings

Receivers leverage network configuration to set connection and transport information.

  • endpoint: Configures the address for this network connection. For TCP and UDP networks, the address has the form "host:port". The host must be a literal IP address, or a host name that can be resolved to IP addresses. The port must be a literal port number or a service name. If the host is a literal IPv6 address it must be enclosed in square brackets, as in "[2001:db8::1]:80" or "[fe80::1%zone]:80". The zone specifies the scope of the literal IPv6 address as defined in RFC 4007.
  • transport: Known protocols are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only), "udp", "udp4" (IPv4-only), "udp6" (IPv6-only), "ip", "ip4" (IPv4-only), "ip6" (IPv6-only), "unix", "unixgram" and "unixpacket".
  • dialer_timeout: DialerTimeout is the maximum amount of time a dial will wait for a connect to complete. The default is no timeout.

Note that for TCP receivers only the endpoint configuration setting is required.

Documentation

Overview

Package confignet implements the configuration settings for protocols to connect and transport data information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrConfig added in v0.95.0

type AddrConfig struct {
	// Endpoint configures the address for this network connection.
	// For TCP and UDP networks, the address has the form "host:port". The host must be a literal IP address,
	// or a host name that can be resolved to IP addresses. The port must be a literal port number or a service name.
	// If the host is a literal IPv6 address it must be enclosed in square brackets, as in "[2001:db8::1]:80" or
	// "[fe80::1%zone]:80". The zone specifies the scope of the literal IPv6 address as defined in RFC 4007.
	Endpoint string `mapstructure:"endpoint"`

	// Transport to use. Allowed protocols are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only), "udp", "udp4" (IPv4-only),
	// "udp6" (IPv6-only), "ip", "ip4" (IPv4-only), "ip6" (IPv6-only), "unix", "unixgram" and "unixpacket".
	Transport TransportType `mapstructure:"transport"`

	// DialerConfig contains options for connecting to an address.
	DialerConfig DialerConfig `mapstructure:"dialer"`
}

AddrConfig represents a network endpoint address.

func NewDefaultAddrConfig added in v0.97.0

func NewDefaultAddrConfig() AddrConfig

NewDefaultAddrConfig creates a new AddrConfig with any default values set

func (*AddrConfig) Dial added in v0.95.0

func (na *AddrConfig) Dial(ctx context.Context) (net.Conn, error)

Dial equivalent with net.Dialer's DialContext for this address.

func (*AddrConfig) Listen added in v0.95.0

func (na *AddrConfig) Listen(ctx context.Context) (net.Listener, error)

Listen equivalent with net.ListenConfig's Listen for this address.

func (*AddrConfig) Validate added in v0.97.0

func (na *AddrConfig) Validate() error

type DialerConfig added in v0.92.0

type DialerConfig struct {
	// Timeout is the maximum amount of time a dial will wait for
	// a connect to complete. The default is no timeout.
	Timeout time.Duration `mapstructure:"timeout"`
}

DialerConfig contains options for connecting to an address.

func NewDefaultDialerConfig added in v0.97.0

func NewDefaultDialerConfig() DialerConfig

NewDefaultDialerConfig creates a new DialerConfig with any default values set

type TCPAddrConfig added in v0.95.0

type TCPAddrConfig struct {
	// Endpoint configures the address for this network connection.
	// The address has the form "host:port". The host must be a literal IP address, or a host name that can be
	// resolved to IP addresses. The port must be a literal port number or a service name.
	// If the host is a literal IPv6 address it must be enclosed in square brackets, as in "[2001:db8::1]:80" or
	// "[fe80::1%zone]:80". The zone specifies the scope of the literal IPv6 address as defined in RFC 4007.
	Endpoint string `mapstructure:"endpoint"`

	// DialerConfig contains options for connecting to an address.
	DialerConfig DialerConfig `mapstructure:"dialer"`
}

TCPAddrConfig represents a TCP endpoint address.

func NewDefaultTCPAddrConfig added in v0.97.0

func NewDefaultTCPAddrConfig() TCPAddrConfig

NewDefaultTCPAddrConfig creates a new TCPAddrConfig with any default values set

func (*TCPAddrConfig) Dial added in v0.95.0

func (na *TCPAddrConfig) Dial(ctx context.Context) (net.Conn, error)

Dial equivalent with net.Dialer's DialContext for this address.

func (*TCPAddrConfig) Listen added in v0.95.0

func (na *TCPAddrConfig) Listen(ctx context.Context) (net.Listener, error)

Listen equivalent with net.ListenConfig's Listen for this address.

type TransportType added in v0.97.0

type TransportType string

TransportType represents a type of network transport protocol

const (
	TransportTypeTCP        TransportType = "tcp"
	TransportTypeTCP4       TransportType = "tcp4"
	TransportTypeTCP6       TransportType = "tcp6"
	TransportTypeUDP        TransportType = "udp"
	TransportTypeUDP4       TransportType = "udp4"
	TransportTypeUDP6       TransportType = "udp6"
	TransportTypeIP         TransportType = "ip"
	TransportTypeIP4        TransportType = "ip4"
	TransportTypeIP6        TransportType = "ip6"
	TransportTypeUnix       TransportType = "unix"
	TransportTypeUnixgram   TransportType = "unixgram"
	TransportTypeUnixPacket TransportType = "unixpacket"
)

func (*TransportType) UnmarshalText added in v0.97.0

func (tt *TransportType) UnmarshalText(in []byte) error

UnmarshalText unmarshalls text to a TransportType. Valid values are "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6", "ip", "ip4", "ip6", "unix", "unixgram" and "unixpacket"

Jump to

Keyboard shortcuts

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