v0.2.1 (#53)
* ios proxy app, tune vp8 tunnel * refactor go modules, move headless joiner android to a go captcha * restore emojis in vk bot keyboard * headless support in vk bot * remove telemost dc hooks, update cretor-app ui and bot * remove telemost support from go code, add fallback to video if mode == dc in joiners * fix headless creators in windows * update vk call creation autoclick * force desktop useragent for creator app * kick disconnected user in headless vk creator immediately when connection is lost * update README.md * update SETUP.md * update release version * add fallback for link creation in vk bot
This commit is contained in:
1 parent
9e1f2a98d9
commit
1b2d6bc5d3
89 files changed
+3503
-2158
No files matched your search
@@ -0,0 +1,58 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func FixICEURL(iceURL string) string {
|
||||
idx := strings.Index(iceURL, ":")
|
||||
if idx < 0 {
|
||||
return iceURL
|
||||
}
|
||||
scheme := iceURL[:idx]
|
||||
if scheme != "turn" && scheme != "stun" && scheme != "turns" && scheme != "stuns" {
|
||||
return iceURL
|
||||
}
|
||||
rest := iceURL[idx+1:]
|
||||
if strings.HasPrefix(rest, "[") {
|
||||
return iceURL
|
||||
}
|
||||
if strings.Count(rest, ":") <= 1 {
|
||||
return iceURL
|
||||
}
|
||||
params := ""
|
||||
if qm := strings.Index(rest, "?"); qm >= 0 {
|
||||
params = rest[qm:]
|
||||
rest = rest[:qm]
|
||||
}
|
||||
lastColon := strings.LastIndex(rest, ":")
|
||||
if lastColon > 0 {
|
||||
host := rest[:lastColon]
|
||||
port := rest[lastColon+1:]
|
||||
if net.ParseIP(host) != nil {
|
||||
return scheme + ":[" + host + "]:" + port + params
|
||||
}
|
||||
}
|
||||
if net.ParseIP(rest) != nil {
|
||||
return scheme + ":[" + rest + "]" + params
|
||||
}
|
||||
return iceURL
|
||||
}
|
||||
|
||||
func ExtractICEHost(iceURL string) string {
|
||||
idx := strings.Index(iceURL, ":")
|
||||
if idx < 0 {
|
||||
return ""
|
||||
}
|
||||
rest := iceURL[idx+1:]
|
||||
params := strings.Index(rest, "?")
|
||||
if params >= 0 {
|
||||
rest = rest[:params]
|
||||
}
|
||||
host, _, err := net.SplitHostPort(rest)
|
||||
if err != nil {
|
||||
return rest
|
||||
}
|
||||
return host
|
||||
}
|
||||
Reference in new issue
Block a user