mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-07-22 23:33:29 +03:00
Add admin panel, manager, node_manager, bandwidth limiter, connection limiter, bonding, failover, vless encryption, mkcp transport
This commit is contained in:
@@ -21,6 +21,7 @@ type _V2RayTransportOptions struct {
|
||||
GRPCOptions V2RayGRPCOptions `json:"-"`
|
||||
HTTPUpgradeOptions V2RayHTTPUpgradeOptions `json:"-"`
|
||||
XHTTPOptions V2RayXHTTPOptions `json:"-"`
|
||||
KCPOptions V2RayKCPOptions `json:"-"`
|
||||
}
|
||||
|
||||
type V2RayTransportOptions _V2RayTransportOptions
|
||||
@@ -40,6 +41,8 @@ func (o V2RayTransportOptions) MarshalJSON() ([]byte, error) {
|
||||
v = o.HTTPUpgradeOptions
|
||||
case C.V2RayTransportTypeXHTTP:
|
||||
v = o.XHTTPOptions
|
||||
case C.V2RayTransportTypeKCP:
|
||||
v = o.KCPOptions
|
||||
case "":
|
||||
return nil, E.New("missing transport type")
|
||||
default:
|
||||
@@ -67,6 +70,8 @@ func (o *V2RayTransportOptions) UnmarshalJSON(bytes []byte) error {
|
||||
v = &o.HTTPUpgradeOptions
|
||||
case C.V2RayTransportTypeXHTTP:
|
||||
v = &o.XHTTPOptions
|
||||
case C.V2RayTransportTypeKCP:
|
||||
v = &o.KCPOptions
|
||||
default:
|
||||
return E.New("unknown transport type: " + o.Type)
|
||||
}
|
||||
@@ -250,3 +255,64 @@ func (m *V2RayXHTTPXmuxOptions) GetNormalizedHMaxRequestTimes() Xbadoption.Range
|
||||
func (m *V2RayXHTTPXmuxOptions) GetNormalizedHMaxReusableSecs() Xbadoption.Range {
|
||||
return m.HMaxReusableSecs
|
||||
}
|
||||
|
||||
type V2RayKCPOptions struct {
|
||||
MTU uint32 `json:"mtu,omitempty"`
|
||||
TTI uint32 `json:"tti,omitempty"`
|
||||
UplinkCapacity uint32 `json:"uplink_capacity,omitempty"`
|
||||
DownlinkCapacity uint32 `json:"downlink_capacity,omitempty"`
|
||||
Congestion bool `json:"congestion,omitempty"`
|
||||
ReadBufferSize uint32 `json:"read_buffer_size,omitempty"`
|
||||
WriteBufferSize uint32 `json:"write_buffer_size,omitempty"`
|
||||
HeaderType string `json:"header_type,omitempty"`
|
||||
Seed string `json:"seed,omitempty"`
|
||||
}
|
||||
|
||||
func (k *V2RayKCPOptions) GetMTU() uint32 {
|
||||
if k.MTU == 0 {
|
||||
return 1350
|
||||
}
|
||||
return k.MTU
|
||||
}
|
||||
|
||||
func (k *V2RayKCPOptions) GetTTI() uint32 {
|
||||
if k.TTI == 0 {
|
||||
return 50
|
||||
}
|
||||
return k.TTI
|
||||
}
|
||||
|
||||
func (k *V2RayKCPOptions) GetUplinkCapacity() uint32 {
|
||||
if k.UplinkCapacity == 0 {
|
||||
return 12
|
||||
}
|
||||
return k.UplinkCapacity
|
||||
}
|
||||
|
||||
func (k *V2RayKCPOptions) GetDownlinkCapacity() uint32 {
|
||||
if k.DownlinkCapacity == 0 {
|
||||
return 100
|
||||
}
|
||||
return k.DownlinkCapacity
|
||||
}
|
||||
|
||||
func (k *V2RayKCPOptions) GetReadBufferSize() uint32 {
|
||||
if k.ReadBufferSize == 0 {
|
||||
return 1
|
||||
}
|
||||
return k.ReadBufferSize
|
||||
}
|
||||
|
||||
func (k *V2RayKCPOptions) GetWriteBufferSize() uint32 {
|
||||
if k.WriteBufferSize == 0 {
|
||||
return 1
|
||||
}
|
||||
return k.WriteBufferSize
|
||||
}
|
||||
|
||||
func (k *V2RayKCPOptions) GetHeaderType() string {
|
||||
if k.HeaderType == "" {
|
||||
return "none"
|
||||
}
|
||||
return k.HeaderType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user