mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-08-08 19:45:18 +03:00
Fix Wireguard options
This commit is contained in:
@@ -235,17 +235,30 @@ func (e *Endpoint) Start(resolve bool) error {
|
||||
if e.options.Amnezia.I5 != "" {
|
||||
ipcConf.WriteString("\ni5=" + e.options.Amnezia.I5)
|
||||
}
|
||||
if e.options.Amnezia.J1 != "" {
|
||||
ipcConf.WriteString("\nj1=" + e.options.Amnezia.J1)
|
||||
if e.options.Amnezia.HeaderProtectionKey != "" {
|
||||
headerProtectionKeyBytes, err := base64.StdEncoding.DecodeString(e.options.Amnezia.HeaderProtectionKey)
|
||||
if err != nil {
|
||||
return E.Cause(err, "decode header protection key")
|
||||
}
|
||||
ipcConf.WriteString("\nheader_protection_key=" + hex.EncodeToString(headerProtectionKeyBytes))
|
||||
}
|
||||
if e.options.Amnezia.J2 != "" {
|
||||
ipcConf.WriteString("\nj2=" + e.options.Amnezia.J2)
|
||||
if e.options.Amnezia.ContentPaddingAddition != nil {
|
||||
ipcConf.WriteString("\ncontent_padding_addition=" + e.options.Amnezia.ContentPaddingAddition.String())
|
||||
}
|
||||
if e.options.Amnezia.J3 != "" {
|
||||
ipcConf.WriteString("\nj3=" + e.options.Amnezia.J3)
|
||||
if e.options.Amnezia.RekeyAfterTime != nil {
|
||||
ipcConf.WriteString("\nrekey_after_time=" + e.options.Amnezia.RekeyAfterTime.String())
|
||||
}
|
||||
if e.options.Amnezia.ITime > 0 {
|
||||
ipcConf.WriteString("\nitime=" + strconv.FormatInt(e.options.Amnezia.ITime, 10))
|
||||
if e.options.Amnezia.RekeyTimeout != nil {
|
||||
ipcConf.WriteString("\nrekey_timeout=" + e.options.Amnezia.RekeyTimeout.String())
|
||||
}
|
||||
if e.options.Amnezia.RejectAfterTime != nil {
|
||||
ipcConf.WriteString("\nreject_after_time=" + e.options.Amnezia.RejectAfterTime.String())
|
||||
}
|
||||
if e.options.Amnezia.KeepaliveTimeout != nil {
|
||||
ipcConf.WriteString("\nkeepalive_timeout=" + e.options.Amnezia.KeepaliveTimeout.String())
|
||||
}
|
||||
if e.options.Amnezia.MaxHandshakeAttempts != nil {
|
||||
ipcConf.WriteString("\nmax_handshake_attempts=" + e.options.Amnezia.MaxHandshakeAttempts.String())
|
||||
}
|
||||
}
|
||||
for _, peer := range e.peers {
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
"github.com/sagernet/sing/common/json/badoption"
|
||||
tun "github.com/sagernet/sing-tun"
|
||||
"github.com/sagernet/sing/common/json/badoption"
|
||||
"github.com/sagernet/sing/common/logger"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
@@ -43,24 +43,27 @@ type PeerOptions struct {
|
||||
}
|
||||
|
||||
type AmneziaOptions struct {
|
||||
JC int
|
||||
JMin int
|
||||
JMax int
|
||||
S1 int
|
||||
S2 int
|
||||
S3 int
|
||||
S4 int
|
||||
H1 *badoption.Range[uint32]
|
||||
H2 *badoption.Range[uint32]
|
||||
H3 *badoption.Range[uint32]
|
||||
H4 *badoption.Range[uint32]
|
||||
I1 string
|
||||
I2 string
|
||||
I3 string
|
||||
I4 string
|
||||
I5 string
|
||||
J1 string
|
||||
J2 string
|
||||
J3 string
|
||||
ITime int64
|
||||
JC int
|
||||
JMin int
|
||||
JMax int
|
||||
S1 int
|
||||
S2 int
|
||||
S3 int
|
||||
S4 int
|
||||
H1 *badoption.Range[uint32]
|
||||
H2 *badoption.Range[uint32]
|
||||
H3 *badoption.Range[uint32]
|
||||
H4 *badoption.Range[uint32]
|
||||
I1 string
|
||||
I2 string
|
||||
I3 string
|
||||
I4 string
|
||||
I5 string
|
||||
HeaderProtectionKey string
|
||||
ContentPaddingAddition *badoption.Range[uint32]
|
||||
RekeyAfterTime *badoption.Range[uint32]
|
||||
RekeyTimeout *badoption.Range[uint32]
|
||||
RejectAfterTime *badoption.Range[uint32]
|
||||
KeepaliveTimeout *badoption.Range[uint32]
|
||||
MaxHandshakeAttempts *badoption.Range[uint32]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user