mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-20 16:24:25 +00:00
wireguard: Add random_trailers and disable_cookies amnezia options
This commit is contained in:
@@ -58,4 +58,6 @@ type WireGuardAmnezia struct {
|
||||
RejectAfterTime *badoption.Range[uint32] `json:"reject_after_time,omitempty"`
|
||||
KeepaliveTimeout *badoption.Range[uint32] `json:"keepalive_timeout,omitempty"`
|
||||
MaxHandshakeAttempts *badoption.Range[uint32] `json:"max_handshake_attempts,omitempty"`
|
||||
RandomTrailers bool `json:"random_trailers,omitempty"`
|
||||
DisableCookies bool `json:"disable_cookies,omitempty"`
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL
|
||||
RejectAfterTime: options.Amnezia.RejectAfterTime,
|
||||
KeepaliveTimeout: options.Amnezia.KeepaliveTimeout,
|
||||
MaxHandshakeAttempts: options.Amnezia.MaxHandshakeAttempts,
|
||||
RandomTrailers: options.Amnezia.RandomTrailers,
|
||||
DisableCookies: options.Amnezia.DisableCookies,
|
||||
}
|
||||
}
|
||||
networkManager := service.FromContext[adapter.NetworkManager](ctx)
|
||||
|
||||
@@ -239,6 +239,12 @@ func (e *Endpoint) Start(postStart bool) error {
|
||||
if e.options.Amnezia.MaxHandshakeAttempts != nil {
|
||||
ipcConf.WriteString("\nmax_handshake_attempts=" + e.options.Amnezia.MaxHandshakeAttempts.String())
|
||||
}
|
||||
if e.options.Amnezia.RandomTrailers {
|
||||
ipcConf.WriteString("\nrandom_trailers=true")
|
||||
}
|
||||
if e.options.Amnezia.DisableCookies {
|
||||
ipcConf.WriteString("\ndisable_cookies=true")
|
||||
}
|
||||
}
|
||||
for _, peer := range e.peers {
|
||||
ipcConf.WriteString(peer.GenerateIpcLines())
|
||||
|
||||
@@ -74,4 +74,6 @@ type AmneziaOptions struct {
|
||||
RejectAfterTime *badoption.Range[uint32]
|
||||
KeepaliveTimeout *badoption.Range[uint32]
|
||||
MaxHandshakeAttempts *badoption.Range[uint32]
|
||||
RandomTrailers bool
|
||||
DisableCookies bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user