mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-12-05 23:35:37 +00:00
add: tuic protocol
This commit is contained in:
@@ -85,6 +85,7 @@ type Proxy struct {
|
|||||||
Vless
|
Vless
|
||||||
Vmess
|
Vmess
|
||||||
Socks
|
Socks
|
||||||
|
Tuic
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p Proxy) MarshalYAML() (any, error) {
|
func (p Proxy) MarshalYAML() (any, error) {
|
||||||
@@ -179,6 +180,16 @@ func (p Proxy) MarshalYAML() (any, error) {
|
|||||||
Name: p.Name,
|
Name: p.Name,
|
||||||
Socks: p.Socks,
|
Socks: p.Socks,
|
||||||
}, nil
|
}, nil
|
||||||
|
case "tuic":
|
||||||
|
return struct {
|
||||||
|
Type string `yaml:"type"`
|
||||||
|
Name string `yaml:"name"`
|
||||||
|
Tuic `yaml:",inline"`
|
||||||
|
}{
|
||||||
|
Type: p.Type,
|
||||||
|
Name: p.Name,
|
||||||
|
Tuic: p.Tuic,
|
||||||
|
}, nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported proxy type: %s", p.Type)
|
return nil, fmt.Errorf("unsupported proxy type: %s", p.Type)
|
||||||
}
|
}
|
||||||
@@ -296,7 +307,16 @@ func (p *Proxy) UnmarshalYAML(node *yaml.Node) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
p.Socks = data.Socks
|
p.Socks = data.Socks
|
||||||
|
case "tuic":
|
||||||
|
var data struct {
|
||||||
|
Type string `yaml:"type"`
|
||||||
|
Name string `yaml:"name"`
|
||||||
|
Tuic `yaml:",inline"`
|
||||||
|
}
|
||||||
|
if err := node.Decode(&data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
p.Tuic = data.Tuic
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unsupported proxy type: %s", temp.Type)
|
return fmt.Errorf("unsupported proxy type: %s", temp.Type)
|
||||||
}
|
}
|
||||||
|
|||||||
35
model/proxy/tuic.go
Normal file
35
model/proxy/tuic.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package proxy
|
||||||
|
|
||||||
|
type Tuic struct {
|
||||||
|
Server string `proxy:"server"`
|
||||||
|
Port int `proxy:"port"`
|
||||||
|
Token string `proxy:"token,omitempty"`
|
||||||
|
UUID string `proxy:"uuid,omitempty"`
|
||||||
|
Password string `proxy:"password,omitempty"`
|
||||||
|
Ip string `proxy:"ip,omitempty"`
|
||||||
|
HeartbeatInterval int `proxy:"heartbeat-interval,omitempty"`
|
||||||
|
ALPN []string `proxy:"alpn,omitempty"`
|
||||||
|
ReduceRtt bool `proxy:"reduce-rtt,omitempty"`
|
||||||
|
RequestTimeout int `proxy:"request-timeout,omitempty"`
|
||||||
|
UdpRelayMode string `proxy:"udp-relay-mode,omitempty"`
|
||||||
|
CongestionController string `proxy:"congestion-controller,omitempty"`
|
||||||
|
DisableSni bool `proxy:"disable-sni,omitempty"`
|
||||||
|
MaxUdpRelayPacketSize int `proxy:"max-udp-relay-packet-size,omitempty"`
|
||||||
|
|
||||||
|
FastOpen bool `proxy:"fast-open,omitempty"`
|
||||||
|
MaxOpenStreams int `proxy:"max-open-streams,omitempty"`
|
||||||
|
CWND int `proxy:"cwnd,omitempty"`
|
||||||
|
SkipCertVerify bool `proxy:"skip-cert-verify,omitempty"`
|
||||||
|
Fingerprint string `proxy:"fingerprint,omitempty"`
|
||||||
|
Certificate string `proxy:"certificate,omitempty"`
|
||||||
|
PrivateKey string `proxy:"private-key,omitempty"`
|
||||||
|
ReceiveWindowConn int `proxy:"recv-window-conn,omitempty"`
|
||||||
|
ReceiveWindow int `proxy:"recv-window,omitempty"`
|
||||||
|
DisableMTUDiscovery bool `proxy:"disable-mtu-discovery,omitempty"`
|
||||||
|
MaxDatagramFrameSize int `proxy:"max-datagram-frame-size,omitempty"`
|
||||||
|
SNI string `proxy:"sni,omitempty"`
|
||||||
|
ECHOpts ECHOptions `proxy:"ech-opts,omitempty"`
|
||||||
|
|
||||||
|
UDPOverStream bool `proxy:"udp-over-stream,omitempty"`
|
||||||
|
UDPOverStreamVersion int `proxy:"udp-over-stream-version,omitempty"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user