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

     1  ### Structure
     2  
     3  ```json
     4  {
     5    "type": "wireguard",
     6    "tag": "wireguard-out",
     7    
     8    "server": "127.0.0.1",
     9    "server_port": 1080,
    10    "system_interface": false,
    11    "interface_name": "wg0",
    12    "local_address": [
    13      "10.0.0.2/32"
    14    ],
    15    "private_key": "YNXtAzepDqRv9H52osJVDQnznT5AM11eCK3ESpwSt04=",
    16    "peer_public_key": "Z1XXLsKYkYxuiYjJIkRvtIKFepCYHTgON+GwPq7SOV4=",
    17    "pre_shared_key": "31aIhAPwktDGpH4JDhA8GNvjFXEf/a6+UaQRyOAiyfM=",
    18    "reserved": [0, 0, 0],
    19    "workers": 4,
    20    "mtu": 1408,
    21    "network": "tcp",
    22  
    23    ... // Dial Fields
    24  }
    25  ```
    26  
    27  !!! warning ""
    28  
    29      WireGuard is not included by default, see [Installation](/#installation).
    30  
    31  !!! warning ""
    32  
    33      gVisor, which is required by the unprivileged WireGuard is not included by default, see [Installation](/#installation).
    34  
    35  ### Fields
    36  
    37  #### server
    38  
    39  ==Required==
    40  
    41  The server address.
    42  
    43  #### server_port
    44  
    45  ==Required==
    46  
    47  The server port.
    48  
    49  #### system_interface
    50  
    51  Use system tun support.
    52  
    53  Requires privilege and cannot conflict with system interfaces.
    54  
    55  Forced if gVisor not included in the build.
    56  
    57  #### interface_name
    58  
    59  Custom device name when `system_interface` enabled.
    60  
    61  #### local_address
    62  
    63  ==Required==
    64  
    65  List of IP (v4 or v6) address prefixes to be assigned to the interface.
    66  
    67  #### private_key
    68  
    69  ==Required==
    70  
    71  WireGuard requires base64-encoded public and private keys. These can be generated using the wg(8) utility:
    72  
    73  ```shell
    74  wg genkey
    75  echo "private key" || wg pubkey
    76  ```
    77  
    78  #### peer_public_key
    79  
    80  ==Required==
    81  
    82  WireGuard peer public key.
    83  
    84  #### pre_shared_key
    85  
    86  WireGuard pre-shared key.
    87  
    88  #### reserved
    89  
    90  WireGuard reserved field bytes.
    91  
    92  #### workers
    93  
    94  WireGuard worker count.
    95  
    96  CPU count is used by default.
    97  
    98  #### mtu
    99  
   100  WireGuard MTU.
   101  
   102  1408 will be used if empty.
   103  
   104  #### network
   105  
   106  Enabled network
   107  
   108  One of `tcp` `udp`.
   109  
   110  Both is enabled by default.
   111  
   112  ### Dial Fields
   113  
   114  See [Dial Fields](/configuration/shared/dial) for details.