github.com/sagernet/sing-box@v1.9.0-rc.20/docs/configuration/outbound/wireguard.md (about)

     1  !!! quote "Changes in sing-box 1.8.0"
     2      
     3      :material-plus: [gso](#gso)  
     4  
     5  ### Structure
     6  
     7  ```json
     8  {
     9    "type": "wireguard",
    10    "tag": "wireguard-out",
    11    
    12    "server": "127.0.0.1",
    13    "server_port": 1080,
    14    "system_interface": false,
    15    "gso": false,
    16    "interface_name": "wg0",
    17    "local_address": [
    18      "10.0.0.2/32"
    19    ],
    20    "private_key": "YNXtAzepDqRv9H52osJVDQnznT5AM11eCK3ESpwSt04=",
    21    "peers": [
    22      {
    23        "server": "127.0.0.1",
    24        "server_port": 1080,
    25        "public_key": "Z1XXLsKYkYxuiYjJIkRvtIKFepCYHTgON+GwPq7SOV4=",
    26        "pre_shared_key": "31aIhAPwktDGpH4JDhA8GNvjFXEf/a6+UaQRyOAiyfM=",
    27        "allowed_ips": [
    28          "0.0.0.0/0"
    29        ],
    30        "reserved": [0, 0, 0]
    31      }
    32    ],
    33    "peer_public_key": "Z1XXLsKYkYxuiYjJIkRvtIKFepCYHTgON+GwPq7SOV4=",
    34    "pre_shared_key": "31aIhAPwktDGpH4JDhA8GNvjFXEf/a6+UaQRyOAiyfM=",
    35    "reserved": [0, 0, 0],
    36    "workers": 4,
    37    "mtu": 1408,
    38    "network": "tcp",
    39  
    40    ... // Dial Fields
    41  }
    42  ```
    43  
    44  ### Fields
    45  
    46  #### server
    47  
    48  ==Required if multi-peer disabled==
    49  
    50  The server address.
    51  
    52  #### server_port
    53  
    54  ==Required if multi-peer disabled==
    55  
    56  The server port.
    57  
    58  #### system_interface
    59  
    60  Use system interface.
    61  
    62  Requires privilege and cannot conflict with exists system interfaces.
    63  
    64  Forced if gVisor not included in the build.
    65  
    66  #### interface_name
    67  
    68  Custom interface name for system interface.
    69  
    70  #### gso
    71  
    72  !!! question "Since sing-box 1.8.0"
    73  
    74  !!! quote ""
    75  
    76      Only supported on Linux.
    77  
    78  Try to enable generic segmentation offload.
    79  
    80  #### local_address
    81  
    82  ==Required==
    83  
    84  List of IP (v4 or v6) address prefixes to be assigned to the interface.
    85  
    86  #### private_key
    87  
    88  ==Required==
    89  
    90  WireGuard requires base64-encoded public and private keys. These can be generated using the wg(8) utility:
    91  
    92  ```shell
    93  wg genkey
    94  echo "private key" || wg pubkey
    95  ```
    96  
    97  #### peers
    98  
    99  Multi-peer support. 
   100  
   101  If enabled, `server, server_port, peer_public_key, pre_shared_key` will be ignored.
   102  
   103  #### peers.allowed_ips
   104  
   105  WireGuard allowed IPs.
   106  
   107  #### peers.reserved
   108  
   109  WireGuard reserved field bytes.
   110  
   111  `$outbound.reserved` will be used if empty.
   112  
   113  #### peer_public_key
   114  
   115  ==Required if multi-peer disabled==
   116  
   117  WireGuard peer public key.
   118  
   119  #### pre_shared_key
   120  
   121  WireGuard pre-shared key.
   122  
   123  #### reserved
   124  
   125  WireGuard reserved field bytes.
   126  
   127  #### workers
   128  
   129  WireGuard worker count.
   130  
   131  CPU count is used by default.
   132  
   133  #### mtu
   134  
   135  WireGuard MTU.
   136  
   137  1408 will be used if empty.
   138  
   139  #### network
   140  
   141  Enabled network
   142  
   143  One of `tcp` `udp`.
   144  
   145  Both is enabled by default.
   146  
   147  ### Dial Fields
   148  
   149  See [Dial Fields](/configuration/shared/dial/) for details.