1
0
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:
2025-12-04 17:08:21 +08:00
parent f16779b441
commit 12de56d275
2 changed files with 56 additions and 1 deletions

View File

@@ -85,6 +85,7 @@ type Proxy struct {
Vless
Vmess
Socks
Tuic
}
func (p Proxy) MarshalYAML() (any, error) {
@@ -179,6 +180,16 @@ func (p Proxy) MarshalYAML() (any, error) {
Name: p.Name,
Socks: p.Socks,
}, 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:
return nil, fmt.Errorf("unsupported proxy type: %s", p.Type)
}
@@ -296,7 +307,16 @@ func (p *Proxy) UnmarshalYAML(node *yaml.Node) error {
return err
}
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:
return fmt.Errorf("unsupported proxy type: %s", temp.Type)
}