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:
36
parser/clash/ssh.go
Normal file
36
parser/clash/ssh.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package clash
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/sagernet/sing-box/option"
|
||||
)
|
||||
|
||||
type SSHOption struct {
|
||||
DialerOptions `yaml:",inline"`
|
||||
ServerOptions `yaml:",inline"`
|
||||
UserName string `yaml:"username"`
|
||||
Password string `yaml:"password,omitempty"`
|
||||
PrivateKey string `yaml:"private-key,omitempty"`
|
||||
PrivateKeyPassphrase string `yaml:"private-key-passphrase,omitempty"`
|
||||
HostKey []string `yaml:"host-key,omitempty"`
|
||||
HostKeyAlgorithms []string `yaml:"host-key-algorithms,omitempty"`
|
||||
}
|
||||
|
||||
func (s *SSHOption) Build() any {
|
||||
options := &option.SSHOutboundOptions{
|
||||
DialerOptions: s.DialerOptions.Build(),
|
||||
ServerOptions: s.ServerOptions.Build(),
|
||||
User: s.UserName,
|
||||
Password: s.Password,
|
||||
PrivateKeyPassphrase: s.PrivateKeyPassphrase,
|
||||
HostKey: s.HostKey,
|
||||
HostKeyAlgorithms: s.HostKeyAlgorithms,
|
||||
}
|
||||
if strings.Contains(s.PrivateKey, "PRIVATE KEY") {
|
||||
options.PrivateKey = trimStringArray(strings.Split(s.PrivateKey, "\n"))
|
||||
} else {
|
||||
options.PrivateKeyPath = s.PrivateKey
|
||||
}
|
||||
return options
|
||||
}
|
||||
Reference in New Issue
Block a user