mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-07-28 09:41:51 +03:00
Integrate Amnezia 1.5
This commit is contained in:
@@ -181,19 +181,71 @@ func (e *Endpoint) Start(resolve bool) error {
|
||||
e.tunDevice.SetDevice(wgDevice)
|
||||
ipcConf := e.ipcConf
|
||||
if e.options.Amnezia != nil {
|
||||
ipcConf += "\njc=" + strconv.Itoa(e.options.Amnezia.JC) + "\n"
|
||||
ipcConf += "jmin=" + strconv.Itoa(e.options.Amnezia.JMin) + "\n"
|
||||
ipcConf += "jmax=" + strconv.Itoa(e.options.Amnezia.JMax) + "\n"
|
||||
ipcConf += "s1=" + strconv.Itoa(e.options.Amnezia.S1) + "\n"
|
||||
ipcConf += "s2=" + strconv.Itoa(e.options.Amnezia.S2) + "\n"
|
||||
ipcConf += "h1=" + strconv.FormatUint(uint64(e.options.Amnezia.H1), 10) + "\n"
|
||||
ipcConf += "h2=" + strconv.FormatUint(uint64(e.options.Amnezia.H2), 10) + "\n"
|
||||
ipcConf += "h3=" + strconv.FormatUint(uint64(e.options.Amnezia.H3), 10) + "\n"
|
||||
ipcConf += "h4=" + strconv.FormatUint(uint64(e.options.Amnezia.H4), 10)
|
||||
if e.options.Amnezia.JC > 0 {
|
||||
ipcConf += "\njc=" + strconv.Itoa(e.options.Amnezia.JC)
|
||||
}
|
||||
if e.options.Amnezia.JMin > 0 {
|
||||
ipcConf += "\njmin=" + strconv.Itoa(e.options.Amnezia.JMin)
|
||||
}
|
||||
if e.options.Amnezia.JMax > 0 {
|
||||
ipcConf += "\njmax=" + strconv.Itoa(e.options.Amnezia.JMax)
|
||||
}
|
||||
if e.options.Amnezia.S1 > 0 {
|
||||
ipcConf += "\ns1=" + strconv.Itoa(e.options.Amnezia.S1)
|
||||
}
|
||||
if e.options.Amnezia.S2 > 0 {
|
||||
ipcConf += "\ns2=" + strconv.Itoa(e.options.Amnezia.S2)
|
||||
}
|
||||
if e.options.Amnezia.S3 > 0 {
|
||||
ipcConf += "\ns3=" + strconv.Itoa(e.options.Amnezia.S3)
|
||||
}
|
||||
if e.options.Amnezia.S4 > 0 {
|
||||
ipcConf += "\ns4=" + strconv.Itoa(e.options.Amnezia.S4)
|
||||
}
|
||||
if e.options.Amnezia.H1 > 0 {
|
||||
ipcConf += "\nh1=" + strconv.FormatUint(uint64(e.options.Amnezia.H1), 10)
|
||||
}
|
||||
if e.options.Amnezia.H2 > 0 {
|
||||
ipcConf += "\nh2=" + strconv.FormatUint(uint64(e.options.Amnezia.H2), 10)
|
||||
}
|
||||
if e.options.Amnezia.H3 > 0 {
|
||||
ipcConf += "\nh3=" + strconv.FormatUint(uint64(e.options.Amnezia.H3), 10)
|
||||
}
|
||||
if e.options.Amnezia.H4 > 0 {
|
||||
ipcConf += "\nh4=" + strconv.FormatUint(uint64(e.options.Amnezia.H4), 10)
|
||||
}
|
||||
if e.options.Amnezia.I1 != "" {
|
||||
ipcConf += "\ni1=" + e.options.Amnezia.I1
|
||||
}
|
||||
if e.options.Amnezia.I2 != "" {
|
||||
ipcConf += "\ni2=" + e.options.Amnezia.I2
|
||||
}
|
||||
if e.options.Amnezia.I3 != "" {
|
||||
ipcConf += "\ni3=" + e.options.Amnezia.I3
|
||||
}
|
||||
if e.options.Amnezia.I4 != "" {
|
||||
ipcConf += "\ni4=" + e.options.Amnezia.I4
|
||||
}
|
||||
if e.options.Amnezia.I5 != "" {
|
||||
ipcConf += "\ni5=" + e.options.Amnezia.I5
|
||||
}
|
||||
if e.options.Amnezia.J1 != "" {
|
||||
ipcConf += "\nj1=" + e.options.Amnezia.J1
|
||||
}
|
||||
if e.options.Amnezia.J2 != "" {
|
||||
ipcConf += "\nj2=" + e.options.Amnezia.J2
|
||||
}
|
||||
if e.options.Amnezia.J3 != "" {
|
||||
ipcConf += "\nj3=" + e.options.Amnezia.J3
|
||||
}
|
||||
if e.options.Amnezia.ITime > 0 {
|
||||
ipcConf += "\nitime=" + strconv.FormatInt(e.options.Amnezia.ITime, 10)
|
||||
}
|
||||
}
|
||||
for _, peer := range e.peers {
|
||||
ipcConf += peer.GenerateIpcLines()
|
||||
}
|
||||
logger.Errorf(ipcConf)
|
||||
err = wgDevice.IpcSet(ipcConf)
|
||||
if err != nil {
|
||||
return E.Cause(err, "setup wireguard: \n", ipcConf)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
"github.com/sagernet/sing-tun"
|
||||
tun "github.com/sagernet/sing-tun"
|
||||
"github.com/sagernet/sing/common/logger"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
@@ -40,13 +40,24 @@ type PeerOptions struct {
|
||||
}
|
||||
|
||||
type AmneziaOptions struct {
|
||||
JC int
|
||||
JMin int
|
||||
JMax int
|
||||
S1 int
|
||||
S2 int
|
||||
H1 uint32
|
||||
H2 uint32
|
||||
H3 uint32
|
||||
H4 uint32
|
||||
JC int
|
||||
JMin int
|
||||
JMax int
|
||||
S1 int
|
||||
S2 int
|
||||
S3 int
|
||||
S4 int
|
||||
H1 uint32
|
||||
H2 uint32
|
||||
H3 uint32
|
||||
H4 uint32
|
||||
I1 string
|
||||
I2 string
|
||||
I3 string
|
||||
I4 string
|
||||
I5 string
|
||||
J1 string
|
||||
J2 string
|
||||
J3 string
|
||||
ITime int64
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user