mirror of
https://github.com/daeuniverse/dae.git
synced 2025-01-05 13:08:57 +07:00
fix: fix dialer switching if only one node and fix ss+simple-obfs
This commit is contained in:
parent
f2fba0a261
commit
55301897e0
@ -153,7 +153,7 @@ func (a *AliveDialerSet) NotifyLatencyChange(dialer *Dialer, alive bool) {
|
|||||||
a.minLatency.latency = latency
|
a.minLatency.latency = latency
|
||||||
a.minLatency.dialer = dialer
|
a.minLatency.dialer = dialer
|
||||||
} else if a.minLatency.dialer == dialer {
|
} else if a.minLatency.dialer == dialer {
|
||||||
if latency > a.minLatency.latency {
|
if !alive || latency > a.minLatency.latency {
|
||||||
// Latency increases.
|
// Latency increases.
|
||||||
a.minLatency.latency = time.Hour
|
a.minLatency.latency = time.Hour
|
||||||
a.minLatency.dialer = nil
|
a.minLatency.dialer = nil
|
||||||
|
@ -48,16 +48,8 @@ func (s *Shadowsocks) Dialer(option *dialer.GlobalOption, iOption dialer.Instanc
|
|||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported shadowsocks encryption method: %v", s.Cipher)
|
return nil, fmt.Errorf("unsupported shadowsocks encryption method: %v", s.Cipher)
|
||||||
}
|
}
|
||||||
|
var err error
|
||||||
d := dialer.FullconeDirect // Shadowsocks Proxy supports full-cone.
|
d := dialer.FullconeDirect // Shadowsocks Proxy supports full-cone.
|
||||||
d, err := protocol.NewDialer("shadowsocks", d, protocol.Header{
|
|
||||||
ProxyAddress: net.JoinHostPort(s.Server, strconv.Itoa(s.Port)),
|
|
||||||
Cipher: s.Cipher,
|
|
||||||
Password: s.Password,
|
|
||||||
IsClient: true,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
switch s.Plugin.Name {
|
switch s.Plugin.Name {
|
||||||
case "simple-obfs":
|
case "simple-obfs":
|
||||||
uSimpleObfs := url.URL{
|
uSimpleObfs := url.URL{
|
||||||
@ -74,7 +66,16 @@ func (s *Shadowsocks) Dialer(option *dialer.GlobalOption, iOption dialer.Instanc
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dialer.NewDialer(d, option, iOption, s.Name, s.Protocol, s.ExportToURL()), nil
|
d, err = protocol.NewDialer("shadowsocks", d, protocol.Header{
|
||||||
|
ProxyAddress: net.JoinHostPort(s.Server, strconv.Itoa(s.Port)),
|
||||||
|
Cipher: s.Cipher,
|
||||||
|
Password: s.Password,
|
||||||
|
IsClient: true,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dialer.NewDialer(d, option, iOption, s.Name, s.Protocol, s.ExportToURL()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseSSURL(u string) (data *Shadowsocks, err error) {
|
func ParseSSURL(u string) (data *Shadowsocks, err error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user