mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-14 00:51:12 +03:00
29 lines
1.0 KiB
Go
29 lines
1.0 KiB
Go
package clash
|
|
|
|
import "github.com/sagernet/sing-box/option"
|
|
|
|
type TrojanOption struct {
|
|
DialerOptions `yaml:",inline"`
|
|
ServerOptions `yaml:",inline"`
|
|
TLSOptions `yaml:",inline"`
|
|
Password string `yaml:"password"`
|
|
UDP bool `yaml:"udp,omitempty"`
|
|
Network string `yaml:"network,omitempty"`
|
|
GrpcOpts GrpcOptions `yaml:"grpc-opts,omitempty"`
|
|
WSOpts WSOptions `yaml:"ws-opts,omitempty"`
|
|
MuxOpts *MuxOptions `yaml:"smux,omitempty"`
|
|
}
|
|
|
|
func (t *TrojanOption) Build() any {
|
|
t.TLS = true
|
|
return &option.TrojanOutboundOptions{
|
|
DialerOptions: t.DialerOptions.Build(),
|
|
ServerOptions: t.ServerOptions.Build(),
|
|
Password: t.Password,
|
|
Network: clashNetworks(t.UDP),
|
|
OutboundTLSOptionsContainer: clashTLSOptions(t.Server, &t.TLSOptions),
|
|
Multiplex: t.MuxOpts.Build(),
|
|
Transport: clashTransport(t.Network, HTTPOptions{}, HTTP2Options{}, t.GrpcOpts, t.WSOpts),
|
|
}
|
|
}
|