// Code generated by mdatagen. DO NOT EDIT.

package confignet

import (
	"time"
)

// AddrConfig represents a network endpoint address.
type AddrConfig struct {
	// DialerConfig contains options for connecting to an address.
	DialerConfig DialerConfig `mapstructure:"dialer,omitempty"`

	// 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,omitempty"`

	// Transport defines the type of transport protocol used. 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", "unixpacket" and "npipe" (Windows named pipes, Windows-only).
	Transport TransportType `mapstructure:"transport,omitempty"`

	// prevent unkeyed literal initialization
	_ struct{}
}

// NewDefaultAddrConfig returns a new AddrConfig with its default values applied.
// Prefer this over an empty struct literal so default changes stay in sync automatically.
func NewDefaultAddrConfig() AddrConfig {
	return AddrConfig{
		DialerConfig: NewDefaultDialerConfig(),
	}
}

// DialerConfig contains options for connecting to an address.
type DialerConfig struct {
	// Timeout the maximum amount of time a dial will wait for a connect to complete. The default is no timeout.
	Timeout time.Duration `mapstructure:"timeout,omitempty"`

	// prevent unkeyed literal initialization
	_ struct{}
}

// NewDefaultDialerConfig returns a new DialerConfig with its default values applied.
// Prefer this over an empty struct literal so default changes stay in sync automatically.
func NewDefaultDialerConfig() DialerConfig {
	return DialerConfig{}
}

// TCPAddrConfig represents a TCP endpoint address.
type TCPAddrConfig struct {
	// DialerConfig contains options for connecting to an address.
	DialerConfig DialerConfig `mapstructure:"dialer,omitempty"`

	// 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,omitempty"`

	// prevent unkeyed literal initialization
	_ struct{}
}

// NewDefaultTCPAddrConfig returns a new TCPAddrConfig with its default values applied.
// Prefer this over an empty struct literal so default changes stay in sync automatically.
func NewDefaultTCPAddrConfig() TCPAddrConfig {
	return TCPAddrConfig{
		DialerConfig: NewDefaultDialerConfig(),
	}
}

// TransportType represents a type of network transport protocol
type TransportType string
