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
+2
-43
@@ -2,9 +2,7 @@ package pion
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
@@ -43,45 +41,6 @@ var WsUpgrader = websocket.Upgrader{
|
||||
CheckOrigin: func(r *http.Request) bool { return true },
|
||||
}
|
||||
|
||||
// Wraps bare IPv6 addresses in brackets for TURN/STUN URLs.
|
||||
// Tries host:port split first (more common), then full address.
|
||||
func fixICEURL(url string) string {
|
||||
idx := strings.Index(url, ":")
|
||||
if idx < 0 {
|
||||
return url
|
||||
}
|
||||
scheme := url[:idx]
|
||||
if scheme != "turn" && scheme != "stun" && scheme != "turns" && scheme != "stuns" {
|
||||
return url
|
||||
}
|
||||
rest := url[idx+1:]
|
||||
if strings.HasPrefix(rest, "[") {
|
||||
return url
|
||||
}
|
||||
if strings.Count(rest, ":") <= 1 {
|
||||
return url
|
||||
}
|
||||
params := ""
|
||||
if qm := strings.Index(rest, "?"); qm >= 0 {
|
||||
params = rest[qm:]
|
||||
rest = rest[:qm]
|
||||
}
|
||||
// Try splitting last segment as port first (host:port is more common)
|
||||
lastColon := strings.LastIndex(rest, ":")
|
||||
if lastColon > 0 {
|
||||
host := rest[:lastColon]
|
||||
port := rest[lastColon+1:]
|
||||
if net.ParseIP(host) != nil {
|
||||
return scheme + ":[" + host + "]:" + port + params
|
||||
}
|
||||
}
|
||||
// Fallback: whole thing is an IPv6 address with no port
|
||||
if net.ParseIP(rest) != nil {
|
||||
return scheme + ":[" + rest + "]" + params
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
var iceLogFn func(string, ...any)
|
||||
|
||||
func ParseICEServers(data json.RawMessage) ([]webrtc.ICEServer, error) {
|
||||
@@ -93,7 +52,7 @@ func ParseICEServers(data json.RawMessage) ([]webrtc.ICEServer, error) {
|
||||
for i, s := range servers {
|
||||
urls := make([]string, len(s.URLs))
|
||||
for j, u := range s.URLs {
|
||||
fixed := fixICEURL(u)
|
||||
fixed := common.FixICEURL(u)
|
||||
if iceLogFn != nil && fixed != u {
|
||||
iceLogFn("ice: fix URL %q -> %q", u, fixed)
|
||||
}
|
||||
@@ -111,7 +70,7 @@ func ParseICEServers(data json.RawMessage) ([]webrtc.ICEServer, error) {
|
||||
|
||||
func NewPionAPI(localIP string) *webrtc.API {
|
||||
se := webrtc.SettingEngine{}
|
||||
se.SetNet(&AndroidNet{LocalIP: localIP})
|
||||
se.SetNet(&common.AndroidNet{LocalIP: localIP})
|
||||
return webrtc.NewAPI(webrtc.WithSettingEngine(se))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user