mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-05-31 09:29:45 +00:00
- mobile/: gomobile-bindable entry point for Android (combined libgojni.so) - internal/protect/: Android socket protect via VpnService for olcRTC sockets - internal/names/data/: embedded name pools for client identity generation - client: add SOCKS5 USER/PASS auth (RFC 1929) and bind to 127.0.0.1 - mux: infinite backpressure via waitForBufferSpace, raise buffer to 32MB, remove close-on-overflow (was corrupting reliable TCP streams over DC) - peer: remove 3-second drop in send worker — wait for SCTP buffer to drain instead of dropping packets (broke large HTTP/2 transfers like Instagram/X) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
67 lines
1.8 KiB
Go
67 lines
1.8 KiB
Go
package telemost
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/openlibrecommunity/olcrtc/internal/protect"
|
|
)
|
|
|
|
const apiBase = "https://cloud-api.yandex.ru/telemost_front/v2/telemost"
|
|
|
|
type ConnectionInfo struct {
|
|
RoomID string `json:"room_id"`
|
|
PeerID string `json:"peer_id"`
|
|
Credentials string `json:"credentials"`
|
|
ClientConfig struct {
|
|
MediaServerURL string `json:"media_server_url"`
|
|
} `json:"client_configuration"`
|
|
}
|
|
|
|
func GetConnectionInfo(roomURL, displayName string) (*ConnectionInfo, error) {
|
|
u := fmt.Sprintf("%s/conferences/%s/connection", apiBase, url.QueryEscape(roomURL))
|
|
|
|
req, err := http.NewRequest("GET", u, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
q := req.URL.Query()
|
|
q.Add("next_gen_media_platform_allowed", "true")
|
|
q.Add("display_name", displayName)
|
|
q.Add("waiting_room_supported", "true")
|
|
req.URL.RawQuery = q.Encode()
|
|
|
|
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:149.0) Gecko/20100101 Firefox/149.0")
|
|
req.Header.Set("Accept", "*/*")
|
|
req.Header.Set("Content-Type", "application/json")
|
|
req.Header.Set("Client-Instance-Id", uuid.New().String())
|
|
req.Header.Set("X-Telemost-Client-Version", "187.1.0")
|
|
req.Header.Set("Idempotency-Key", uuid.New().String())
|
|
req.Header.Set("Origin", "https://telemost.yandex.ru")
|
|
req.Header.Set("Referer", "https://telemost.yandex.ru/")
|
|
|
|
client := protect.NewHTTPClient()
|
|
resp, err := client.Do(req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
if resp.StatusCode != http.StatusOK {
|
|
body, _ := io.ReadAll(resp.Body)
|
|
return nil, fmt.Errorf("API error %d: %s", resp.StatusCode, body)
|
|
}
|
|
|
|
var info ConnectionInfo
|
|
if err := json.NewDecoder(resp.Body).Decode(&info); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &info, nil
|
|
}
|