mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-14 00:51:12 +03:00
Add MTProxy, MASQUE, VPN, Link parser. Update AmneziaWG. Remove Tunneling
This commit is contained in:
34
parser/clash/hysteria2.go
Normal file
34
parser/clash/hysteria2.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package clash
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing/common/json/badoption"
|
||||
)
|
||||
|
||||
type Hysteria2Option struct {
|
||||
DialerOptions `yaml:",inline"`
|
||||
ServerOptions `yaml:",inline"`
|
||||
TLSOptions `yaml:",inline"`
|
||||
Ports string `yaml:"ports,omitempty"`
|
||||
HopInterval int `yaml:"hop-interval,omitempty"`
|
||||
Up string `yaml:"up,omitempty"`
|
||||
Down string `yaml:"down,omitempty"`
|
||||
Password string `yaml:"password,omitempty"`
|
||||
Obfs string `yaml:"obfs,omitempty"`
|
||||
ObfsPassword string `yaml:"obfs-password,omitempty"`
|
||||
}
|
||||
|
||||
func (h *Hysteria2Option) Build() any {
|
||||
h.TLS = true
|
||||
return &option.Hysteria2OutboundOptions{
|
||||
DialerOptions: h.DialerOptions.Build(),
|
||||
ServerOptions: h.ServerOptions.Build(),
|
||||
ServerPorts: clashPorts(h.Ports),
|
||||
HopInterval: badoption.Duration(h.HopInterval),
|
||||
UpMbps: clashSpeedToIntMbps(h.Up),
|
||||
DownMbps: clashSpeedToIntMbps(h.Down),
|
||||
Obfs: clashHysteria2Obfs(h.Obfs, h.ObfsPassword),
|
||||
Password: h.Password,
|
||||
OutboundTLSOptionsContainer: clashTLSOptions(h.Server, &h.TLSOptions),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user