mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
ci: added freebsd version
This commit is contained in:
1 parent
2d16870803
commit
2a7eed7667
11 files changed
+34
-25
No files matched your search
+1
-1
@@ -25,7 +25,7 @@ func NewDirect(intface string, dialTimeout, relayTimeout time.Duration) (*Direct
|
||||
|
||||
if intface != "" {
|
||||
if ip := net.ParseIP(intface); ip != nil {
|
||||
d.ip = net.ParseIP(intface)
|
||||
d.ip = ip
|
||||
} else {
|
||||
iface, err := net.InterfaceByName(intface)
|
||||
if err != nil {
|
||||
|
||||
+3
-3
@@ -29,8 +29,8 @@ func RegisterServer(name string, c ServerCreator) {
|
||||
|
||||
// ServerFromURL calls the registered creator to create proxy servers.
|
||||
// dialer is the default upstream dialer so cannot be nil, we can use Default when calling this function.
|
||||
func ServerFromURL(s string, p Proxy) (Server, error) {
|
||||
if p == nil {
|
||||
func ServerFromURL(s string, proxy Proxy) (Server, error) {
|
||||
if proxy == nil {
|
||||
return nil, errors.New("ServerFromURL: dialer cannot be nil")
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func ServerFromURL(s string, p Proxy) (Server, error) {
|
||||
scheme := s[:strings.Index(s, ":")]
|
||||
c, ok := serverCreators[strings.ToLower(scheme)]
|
||||
if ok {
|
||||
return c(s, p)
|
||||
return c(s, proxy)
|
||||
}
|
||||
|
||||
return nil, errors.New("unknown scheme '" + scheme + "'")
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ func NewTLS(s string, d proxy.Dialer, p proxy.Proxy) (*TLS, error) {
|
||||
keyFile: query.Get("key"),
|
||||
}
|
||||
|
||||
if _, p, _ := net.SplitHostPort(t.addr); p == "" {
|
||||
if _, port, _ := net.SplitHostPort(t.addr); port == "" {
|
||||
t.addr = net.JoinHostPort(t.addr, "443")
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ func NewTrojan(s string, d proxy.Dialer, p proxy.Proxy) (*Trojan, error) {
|
||||
// fallback: "127.0.0.1:80",
|
||||
}
|
||||
|
||||
if _, p, _ := net.SplitHostPort(t.addr); p == "" {
|
||||
if _, port, _ := net.SplitHostPort(t.addr); port == "" {
|
||||
t.addr = net.JoinHostPort(t.addr, "443")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user