Network
sockaddr str
yaml value: str
The string should be in <ip>[:<port>] format, in which the port may be omitted if a default value is available.
static sockaddr str
yaml value: str
The string should be in @<domain>:<port> or @<ip>:<port> format.
It is different from upstream str as:
It will be resolved when we load the config files
The domain is only allowed to be resolved to just 1 IP address
env sockaddr str
yaml value: sockaddr str or static sockaddr str or env var
The string should be in <ip>[:<port>] format, in which the port may be omitted if a default value is available.
ip network str
yaml value: str
The string should be a network address in CIDR format, or just an ip address.
interface name
yaml value: str | u32
The string should be a network interface name or index.
host
yaml value: str
A host value. Which should be either a valid domain, or a valid IP address.
socket buffer config
yaml value: mix
It consists of 2 fields:
recv
optional, type: humanize usize
Set the recv buf size.
default: not set
send
optional, type: humanize usize
Set the send buf size.
default: not set
The yaml value for socket buffer config can be in the following formats:
int | string
The value will be set for both recv and send fields above.
map
The keys of this map are the fields as described above.
udp listen
yaml value: mix
It consists of the following fields:
address
required, type: env sockaddr str
Set the listen socket address.
default: [::]:0, which has empty port
interface
optional: type: interface name
Bind the outgoing socket to a particular device like “eth0”.
default: not set
socket_buffer
optional, type: socket buffer config
Set an explicit socket buffer config.
default: not set
socket_misc_opts
optional, type: udp misc sock opts
Set misc UDP socket options.
default: not set
ipv6_only
optional, type: bool
Listen only to ipv6 address only if address is set to [::].
default: false
instance
optional, type: int
Set how many listen instances. If scale is set, this will be the least value.
default: 1
scale
optional, type: float | string
Set the listen instance count scaled according to available parallelism.
For string value, it could be in percentage (n%) or fractional (n/d) format.
Example:
scale: 1/2 # or scale: 0.5 # or scale: 50%
default: 0
The yaml value for listen can be in the following formats:
int
Set the port only.
-
Set ip and port. The port field is required.
map
The keys of this map are the fields as described above.
udp misc sock opts
yaml value: map
This set misc udp socket options.
Keys:
time_to_live
optional, type: u32, alias: ttl
Set value for ip level socket option IP_TTL, the time-to-live field in each sent packet.
default: not set
hop_limit
optional, type: u32
Set value for ipv6 level socket option IPV6_UNICAST_HOPS, the hop limit field in each sent packet.
default: not set
Added in version 0.1.1.
type_of_service
optional, type: u8, alias: tos
Set value for ip level socket option IP_TOS, the type-of-service field in each sent packet.
default: not set
traffic_class
optional, type: u8
Set value for ipv6 level socket option IPV6_TCLASS, the traffic class field in each sent packet.
default: not set
Added in version 0.1.1.
netfilter_mark
optional, type: u32, alias: mark
Set value for socket level socket option SO_MARK, the netfilter mark value for our tcp sockets.
default: not set
http header value
yaml value: str
This string should be a valid HTTP header value.