mirror of
https://github.com/daeuniverse/dae.git
synced 2025-01-03 13:31:00 +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.dialer = dialer
|
||||
} else if a.minLatency.dialer == dialer {
|
||||
if latency > a.minLatency.latency {
|
||||
if !alive || latency > a.minLatency.latency {
|
||||
// Latency increases.
|
||||
a.minLatency.latency = time.Hour
|
||||
a.minLatency.dialer = nil
|
||||
|
@ -48,16 +48,8 @@ func (s *Shadowsocks) Dialer(option *dialer.GlobalOption, iOption dialer.Instanc
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported shadowsocks encryption method: %v", s.Cipher)
|
||||
}
|
||||
var err error
|
||||
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 {
|
||||
case "simple-obfs":
|
||||
uSimpleObfs := url.URL{
|
||||
@ -74,7 +66,16 @@ func (s *Shadowsocks) Dialer(option *dialer.GlobalOption, iOption dialer.Instanc
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user