mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-20 01:45:00 +03:00
Add wireguard outbound and test
This commit is contained in:
@@ -16,6 +16,7 @@ type _Outbound struct {
|
||||
ShadowsocksOptions ShadowsocksOutboundOptions `json:"-"`
|
||||
VMessOptions VMessOutboundOptions `json:"-"`
|
||||
TrojanOptions TrojanOutboundOptions `json:"-"`
|
||||
WireGuardOptions WireGuardOutboundOptions `json:"-"`
|
||||
SelectorOptions SelectorOutboundOptions `json:"-"`
|
||||
}
|
||||
|
||||
@@ -38,6 +39,8 @@ func (h Outbound) MarshalJSON() ([]byte, error) {
|
||||
v = h.VMessOptions
|
||||
case C.TypeTrojan:
|
||||
v = h.TrojanOptions
|
||||
case C.TypeWireGuard:
|
||||
v = h.WireGuardOptions
|
||||
case C.TypeSelector:
|
||||
v = h.SelectorOptions
|
||||
default:
|
||||
@@ -67,6 +70,8 @@ func (h *Outbound) UnmarshalJSON(bytes []byte) error {
|
||||
v = &h.VMessOptions
|
||||
case C.TypeTrojan:
|
||||
v = &h.TrojanOptions
|
||||
case C.TypeWireGuard:
|
||||
v = &h.WireGuardOptions
|
||||
case C.TypeSelector:
|
||||
v = &h.SelectorOptions
|
||||
default:
|
||||
|
||||
12
option/wireguard.go
Normal file
12
option/wireguard.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package option
|
||||
|
||||
type WireGuardOutboundOptions struct {
|
||||
OutboundDialerOptions
|
||||
ServerOptions
|
||||
LocalAddress Listable[string] `json:"local_address"`
|
||||
PrivateKey string `json:"private_key"`
|
||||
PeerPublicKey string `json:"peer_public_key"`
|
||||
PreSharedKey string `json:"pre_shared_key,omitempty"`
|
||||
MTU uint32 `json:"mtu,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user