Socket option (proto)

config.core.v3.SocketOption

[config.core.v3.SocketOption proto]

Generic socket option message. This would be used to set socket options that might not exist in upstream kernels or precompiled Envoy binaries.

For example:

{
  "description": "support tcp keep alive",
  "state": 0,
  "level": 1,
  "name": 9,
  "int_value": 1,
}

1 means SOL_SOCKET and 9 means SO_KEEPALIVE on Linux. With the above configuration, TCP Keep-Alives can be enabled in socket with Linux, which can be used in listener’s or admin’s socket_options etc.

It should be noted that the name or level may have different values on different platforms.

{
  "description": ...,
  "level": ...,
  "name": ...,
  "int_value": ...,
  "buf_value": ...,
  "state": ...,
  "type": {...}
}
description

(string) An optional name to give this socket option for debugging, etc. Uniqueness is not required and no special meaning is assumed.

level

(int64) Corresponding to the level value passed to setsockopt, such as IPPROTO_TCP

name

(int64) The numeric name as passed to setsockopt

int_value

(int64) Because many sockopts take an int value.

Precisely one of int_value, buf_value must be set.

buf_value

(bytes) Otherwise it’s a byte buffer.

Precisely one of int_value, buf_value must be set.

state

(config.core.v3.SocketOption.SocketState) The state in which the option will be applied. When used in BindConfig STATE_PREBIND is currently the only valid value.

type

(config.core.v3.SocketOption.SocketType) Apply the socket option to the specified socket type. If not specified, the socket option will be applied to all socket types.

config.core.v3.SocketOption.SocketType

[config.core.v3.SocketOption.SocketType proto]

The socket type to apply the socket option to. Only one field should be set. If multiple fields are set, the precedence order will determine the selected one. If none of the fields is set, the socket option will be applied to all socket types.

For example: If stream is set, it takes precedence over datagram.

{
  "stream": {...},
  "datagram": {...}
}
stream

(config.core.v3.SocketOption.SocketType.Stream) Apply the socket option to the stream socket type.

datagram

(config.core.v3.SocketOption.SocketType.Datagram) Apply the socket option to the datagram socket type.

config.core.v3.SocketOption.SocketType.Stream

[config.core.v3.SocketOption.SocketType.Stream proto]

The stream socket type.

config.core.v3.SocketOption.SocketType.Datagram

[config.core.v3.SocketOption.SocketType.Datagram proto]

The datagram socket type.

Enum config.core.v3.SocketOption.SocketState

[config.core.v3.SocketOption.SocketState proto]

STATE_PREBIND

(DEFAULT) ⁣Socket options are applied after socket creation but before binding the socket to a port

STATE_BOUND

⁣Socket options are applied after binding the socket to a port but before calling listen()

STATE_LISTENING

⁣Socket options are applied after calling listen()

config.core.v3.SocketOptionsOverride

[config.core.v3.SocketOptionsOverride proto]

{
  "socket_options": []
}
socket_options

(repeated config.core.v3.SocketOption)