mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-09 12:58:15 +03:00
Add socks outbound
This commit is contained in:
@@ -10,6 +10,7 @@ type _Outbound struct {
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
DirectOptions DirectOutboundOptions `json:"-"`
|
||||
SocksOptions SocksOutboundOptions `json:"-"`
|
||||
ShadowsocksOptions ShadowsocksOutboundOptions `json:"-"`
|
||||
}
|
||||
|
||||
@@ -20,6 +21,8 @@ func (h Outbound) MarshalJSON() ([]byte, error) {
|
||||
switch h.Type {
|
||||
case "direct":
|
||||
v = h.DirectOptions
|
||||
case "socks":
|
||||
v = h.SocksOptions
|
||||
case "shadowsocks":
|
||||
v = h.ShadowsocksOptions
|
||||
default:
|
||||
@@ -37,6 +40,8 @@ func (h *Outbound) UnmarshalJSON(bytes []byte) error {
|
||||
switch h.Type {
|
||||
case "direct":
|
||||
v = &h.DirectOptions
|
||||
case "socks":
|
||||
v = &h.SocksOptions
|
||||
case "shadowsocks":
|
||||
v = &h.ShadowsocksOptions
|
||||
default:
|
||||
@@ -73,6 +78,14 @@ func (o ServerOptions) Build() M.Socksaddr {
|
||||
return M.ParseSocksaddrHostPort(o.Server, o.ServerPort)
|
||||
}
|
||||
|
||||
type SocksOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
Version string `json:"version,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
type ShadowsocksOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
|
||||
Reference in New Issue
Block a user