Joyit hai 1 mes
pai
achega
3c76f2317b
Modificáronse 2 ficheiros con 7 adicións e 1 borrados
  1. 6 0
      hub.go
  2. 1 1
      type.go

+ 6 - 0
hub.go

@@ -689,9 +689,15 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo) (err e
 	go func() {
 		if host.Version == ws2.VERSION && (host.Proto == ws2.PROTO || host.Proto == ws2.PROTO_STL) {
 			runProto = ws2.PROTO
+			if h.cf.PrintMsg {
+				log.Println("[Connect]", host.Proto, addr, host.Path, host.Hash)
+			}
 			conn, err = ws2.Dial(h.cf, host.Proto, addr, host.Path, host.Hash)
 		} else if host.Version == tcp2.VERSION && host.Proto == tcp2.PROTO {
 			runProto = tcp2.PROTO
+			if h.cf.PrintMsg {
+				log.Println("[Connect]", host.Proto, addr, host.Hash)
+			}
 			conn, err = tcp2.Dial(h.cf, addr, host.Hash)
 		} else {
 			err = fmt.Errorf("not correct protocol and version found in: %+v", host)

+ 1 - 1
type.go

@@ -138,7 +138,7 @@ type HostInfo struct {
 // url 格式:ws2://xor:s^7mv7L!Mrn8Y!vn@127.0.0.1:14541/wsv2?proxy=1
 // 仅支持客户端连接使用
 func ParseUrl(url string) (hostInfo *HostInfo, err error) {
-	mx := regexp.MustCompile(`^([a-z]+)([0-9]*)://([^/\?]+)(/[\w\-/]+)?`).FindStringSubmatch(url)
+	mx := regexp.MustCompile(`^([a-z]+)([0-9]*)://([^#/\?]+)(/[\w\-/]+)?`).FindStringSubmatch(url)
 	if mx == nil {
 		return nil, errors.New("invalid url")
 	}