config: added new flag example to print usage examples

This commit is contained in:
nadoo committed 2022-02-16 23:37:25 +08:00
1 parent 5cfb20562a
commit 813c5fef94
6 files changed
+146 -92

No files matched your search

+7 -6
View File
@@ -51,12 +51,13 @@ func NewTrojan(s string, d proxy.Dialer, p proxy.Proxy) (*Trojan, error) {
fallback: query.Get("fallback"),
}
if _, port, _ := net.SplitHostPort(t.addr); port == "" {
t.addr = net.JoinHostPort(t.addr, "443")
}
if t.serverName == "" {
t.serverName = t.addr[:strings.LastIndex(t.addr, ":")]
if t.addr != "" {
if _, port, _ := net.SplitHostPort(t.addr); port == "" {
t.addr = net.JoinHostPort(t.addr, "443")
}
if t.serverName == "" {
t.serverName = t.addr[:strings.LastIndex(t.addr, ":")]
}
}
// pass