Settings
#struct SettingsEverything that decides how a connection is made. The zero value is plain TCP.
| Name | Type | Description |
|---|---|---|
network | str = "tcp" | "tcp", "ws" or "httpupgrade". |
tls | bool = false | Wrap the connection in TLS. A listener needs cert_file and key_file as well. |
sni | str = "" | The server name sent in the TLS handshake and checked against the certificate. Empty means the dialed host. |
alpn | str = "" | The one ALPN protocol to offer, such as "http/1.1". It is a single string, not a list. |
fingerprint | str = "" | A browser name such as "chrome". Kept for links that carry it; it does not change the handshake. |
allow_insecure | bool = false | Skip certificate verification. Unsafe on a real network. |
ca_file | str = "" | A PEM file with the certificate authorities to trust instead of the system ones. |
path | str = "/" | The request path of the WebSocket or upgrade request. The server refuses any other path. |
host | str = "" | The Host header of the upgrade request. A server with this set refuses other host names. |
headers | str = "" | Extra request headers for the client, written as Name: value lines separated by \r\n. |
early_data | int = 0 | The largest number of payload bytes sent in the Sec-WebSocket-Protocol header. 0 turns early data off. |
fragment | bool = false | Split the first bytes of the TLS handshake into small pieces. Client side, with tls only. |
fragment_min | int = 5 | The smallest piece in bytes. |
fragment_max | int = 20 | The largest piece in bytes. |
fragment_delay_ms | int = 10 | The pause between two pieces, in milliseconds. |
cert_file | str = "" | The server certificate chain, as a PEM file. |
key_file | str = "" | The server private key, as a PEM file. |
timeout_ms | int = 0 | How long the TCP connect may take. 0 means the system default. It does not limit reads. |
read_timeout_ms | int = 0 | Idle read timeout of an established connection, in milliseconds. 0 waits forever. |
write_timeout_ms | int = 0 | Idle write timeout of an established connection, in milliseconds. 0 waits forever. |
fragment_mode | str = "tcp" | What fragment splits: "tcp" (the default) writes the hello in several TCP segments, "tls" splits the ClientHello record into several TLS records, "both" does both. |
fragment_sni | bool = false | Also cut inside the server name, so no piece holds the whole name. With fragment_min and fragment_max both 0 this is the only cut. |
fragment_writes | int = 1 | How many of the first handshake writes are fragmented. The default 1 is the ClientHello. |
bind | str = "127.0.0.1" | The address a listener binds to. The default is 127.0.0.1; use ListenAll or "0.0.0.0" to listen on every interface. |
handshake_timeout_ms | int = 10000 | How long a server lets a new connection take to finish the TLS and upgrade handshake before it drops it. 10000 by default. |
max_handshakes | int = 128 | How many handshakes a listener runs at the same time. Further connections are closed at once. 128 by default. |
max_per_source | int = 0 | How many handshakes one source address may have in progress at once. Further connections from it are closed at once. 0 means no limit. |
security | str = "" | Empty for the plain or tls choice, or "reality" to run the Reality handshake instead of TLS. |
reality | reality.Settings | The client Reality settings (net.reality), used when security is "reality". |
reality_server | reality.ServerSettings | The server Reality settings, used by a listener when security is "reality". |
service_name | str = "" | The gRPC service name for network = "grpc". The request path is /service/Tun (/service/TunMulti in multi mode). |
grpc_mode | str = "gun" | "gun" (the default) or "multi", for network = "grpc". |