Add ssh outbound

This commit is contained in:
世界
2022-08-21 19:36:08 +08:00
parent c71f6ba377
commit dc6bb7ab1b
12 changed files with 319 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ type _Outbound struct {
WireGuardOptions WireGuardOutboundOptions `json:"-"`
HysteriaOptions HysteriaOutboundOptions `json:"-"`
TorOptions TorOutboundOptions `json:"-"`
SSHOptions SSHOutboundOptions `json:"-"`
SelectorOptions SelectorOutboundOptions `json:"-"`
}
@@ -47,6 +48,8 @@ func (h Outbound) MarshalJSON() ([]byte, error) {
v = h.HysteriaOptions
case C.TypeTor:
v = h.TorOptions
case C.TypeSSH:
v = h.SSHOptions
case C.TypeSelector:
v = h.SelectorOptions
default:
@@ -82,6 +85,8 @@ func (h *Outbound) UnmarshalJSON(bytes []byte) error {
v = &h.HysteriaOptions
case C.TypeTor:
v = &h.TorOptions
case C.TypeSSH:
v = &h.SSHOptions
case C.TypeSelector:
v = &h.SelectorOptions
default:

13
option/ssh.go Normal file
View File

@@ -0,0 +1,13 @@
package option
type SSHOutboundOptions struct {
OutboundDialerOptions
ServerOptions
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
PrivateKey string `json:"private_key,omitempty"`
PrivateKeyPath string `json:"private_key_path,omitempty"`
PrivateKeyPassphrase string `json:"private_key_passphrase,omitempty"`
HostKeyAlgorithms Listable[string] `json:"host_key_algorithms,omitempty"`
ClientVersion string `json:"client_version,omitempty"`
}