fix vpn notification, add more logs under debug flag
This commit is contained in:
1 parent
d66be97922
commit
2dbc6ea1eb
17 files changed
+75
-12
No files matched your search
@@ -6,6 +6,7 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||||
tools:ignore="QueryAllPackagesPermission" />
|
tools:ignore="QueryAllPackagesPermission" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package bypass.whitelist
|
package bypass.whitelist
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.animation.ArgbEvaluator
|
import android.animation.ArgbEvaluator
|
||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.net.VpnService
|
import android.net.VpnService
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.animation.AccelerateDecelerateInterpolator
|
import android.view.animation.AccelerateDecelerateInterpolator
|
||||||
@@ -16,6 +19,7 @@ import android.widget.Toast
|
|||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.FileProvider
|
import androidx.core.content.FileProvider
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
@@ -101,11 +105,19 @@ class MainActivity :
|
|||||||
else appendLog("VPN permission denied")
|
else appendLog("VPN permission denied")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val notificationPermissionLauncher = registerForActivityResult(
|
||||||
|
ActivityResultContracts.RequestPermission()
|
||||||
|
) { granted ->
|
||||||
|
if (!granted) appendLog("Notification permission denied")
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
|
|
||||||
|
requestNotificationPermissionIfNeeded()
|
||||||
|
|
||||||
bottomNav = findViewById(R.id.bottomNav)
|
bottomNav = findViewById(R.id.bottomNav)
|
||||||
navMain = findViewById(R.id.navMain)
|
navMain = findViewById(R.id.navMain)
|
||||||
navSettings = findViewById(R.id.navSettings)
|
navSettings = findViewById(R.id.navSettings)
|
||||||
@@ -473,6 +485,16 @@ class MainActivity :
|
|||||||
if (intent != null) vpnLauncher.launch(intent) else startVpnService()
|
if (intent != null) vpnLauncher.launch(intent) else startVpnService()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun requestNotificationPermissionIfNeeded() {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return
|
||||||
|
val granted = ContextCompat.checkSelfPermission(
|
||||||
|
this,
|
||||||
|
Manifest.permission.POST_NOTIFICATIONS
|
||||||
|
) == PackageManager.PERMISSION_GRANTED
|
||||||
|
if (granted) return
|
||||||
|
notificationPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
|
||||||
|
}
|
||||||
|
|
||||||
private fun handleIntent(intent: Intent?) {
|
private fun handleIntent(intent: Intent?) {
|
||||||
if (intent?.action != ACTION_AUTO_START) return
|
if (intent?.action != ACTION_AUTO_START) return
|
||||||
intent.action = null
|
intent.action = null
|
||||||
|
|||||||
@@ -379,7 +379,9 @@ func (b *Bridge) handleMessage(raw []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ud, ok := msg["updateDescription"]; ok {
|
if ud, ok := msg["updateDescription"]; ok {
|
||||||
|
if common.Debug {
|
||||||
log.Printf("[tm-ws] <- updateDescription %s", tmapi.BriefJSON(ud))
|
log.Printf("[tm-ws] <- updateDescription %s", tmapi.BriefJSON(ud))
|
||||||
|
}
|
||||||
udMap, _ := ud.(map[string]interface{})
|
udMap, _ := ud.(map[string]interface{})
|
||||||
descs, _ := udMap["description"].([]interface{})
|
descs, _ := udMap["description"].([]interface{})
|
||||||
b.applyDescriptionSnapshot(descs)
|
b.applyDescriptionSnapshot(descs)
|
||||||
@@ -440,7 +442,9 @@ func (b *Bridge) handleMessage(raw []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if sc, ok := msg["slotsConfig"]; ok {
|
if sc, ok := msg["slotsConfig"]; ok {
|
||||||
|
if common.Debug {
|
||||||
log.Printf("[tm-ws] <- slotsConfig %s", tmapi.BriefJSON(sc))
|
log.Printf("[tm-ws] <- slotsConfig %s", tmapi.BriefJSON(sc))
|
||||||
|
}
|
||||||
needRebind := false
|
needRebind := false
|
||||||
presentPids := make(map[string]bool)
|
presentPids := make(map[string]bool)
|
||||||
for _, ev := range tmapi.SlotsConfigBindings(sc) {
|
for _, ev := range tmapi.SlotsConfigBindings(sc) {
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ func (r *SFURelay) readTrack(track *webrtc.TrackRemote) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
recvCount++
|
recvCount++
|
||||||
if recvCount <= 3 || recvCount%200 == 0 {
|
if common.Debug && (recvCount <= 3 || recvCount%200 == 0) {
|
||||||
log.Printf("[video] recv vp8 frame #%d %d bytes", recvCount, len(frameBuf))
|
log.Printf("[video] recv vp8 frame #%d %d bytes", recvCount, len(frameBuf))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,14 +106,18 @@ func (u *TunnelRelay) Init(iceServers []webrtc.ICEServer) error {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
dcNotif.OnOpen(func() { log.Println("[relay] producerNotification DC opened") })
|
dcNotif.OnOpen(func() { log.Println("[relay] producerNotification DC opened") })
|
||||||
dcNotif.OnMessage(func(msg webrtc.DataChannelMessage) {
|
dcNotif.OnMessage(func(msg webrtc.DataChannelMessage) {
|
||||||
|
if common.Debug {
|
||||||
log.Printf("[relay] producerNotification msg len=%d", len(msg.Data))
|
log.Printf("[relay] producerNotification msg len=%d", len(msg.Data))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
dcCmd, err := pc.CreateDataChannel("producerCommand", &webrtc.DataChannelInit{Ordered: &ordered})
|
dcCmd, err := pc.CreateDataChannel("producerCommand", &webrtc.DataChannelInit{Ordered: &ordered})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dcCmd.OnOpen(func() { log.Println("[relay] producerCommand DC opened") })
|
dcCmd.OnOpen(func() { log.Println("[relay] producerCommand DC opened") })
|
||||||
dcCmd.OnMessage(func(msg webrtc.DataChannelMessage) {
|
dcCmd.OnMessage(func(msg webrtc.DataChannelMessage) {
|
||||||
|
if common.Debug {
|
||||||
log.Printf("[relay] producerCommand msg len=%d", len(msg.Data))
|
log.Printf("[relay] producerCommand msg len=%d", len(msg.Data))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
producerScreen, psErr := pc.CreateDataChannel("producerScreenShare", &webrtc.DataChannelInit{Ordered: &ordered})
|
producerScreen, psErr := pc.CreateDataChannel("producerScreenShare", &webrtc.DataChannelInit{Ordered: &ordered})
|
||||||
@@ -459,7 +463,7 @@ func (u *TunnelRelay) readTrack(track *webrtc.TrackRemote) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
recvCount++
|
recvCount++
|
||||||
if recvCount <= 3 || recvCount%200 == 0 {
|
if common.Debug && (recvCount <= 3 || recvCount%200 == 0) {
|
||||||
log.Printf("[video] recv vp8 frame #%d %d bytes", recvCount, len(frameBuf))
|
log.Printf("[video] recv vp8 frame #%d %d bytes", recvCount, len(frameBuf))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/pion/rtp/codecs"
|
"github.com/pion/rtp/codecs"
|
||||||
"github.com/pion/webrtc/v4"
|
"github.com/pion/webrtc/v4"
|
||||||
|
|
||||||
|
"whitelist-bypass/relay/common"
|
||||||
"whitelist-bypass/relay/tunnel"
|
"whitelist-bypass/relay/tunnel"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -500,7 +501,9 @@ func (c *Call) handleSpeakerCamStateChanged(params SpeakerCamStateChangedParams)
|
|||||||
c.peersByID[params.SessionID] = &PeerEntry{SessionID: params.SessionID, CamState: params.CamState, JoinedAt: time.Now()}
|
c.peersByID[params.SessionID] = &PeerEntry{SessionID: params.SessionID, CamState: params.CamState, JoinedAt: time.Now()}
|
||||||
}
|
}
|
||||||
c.peersMu.Unlock()
|
c.peersMu.Unlock()
|
||||||
|
if common.Debug {
|
||||||
c.cfg.LogFn("[call] speaker_cam_state_changed session_id=%s cam=%v", params.SessionID, params.CamState)
|
c.cfg.LogFn("[call] speaker_cam_state_changed session_id=%s cam=%v", params.SessionID, params.CamState)
|
||||||
|
}
|
||||||
if params.CamState {
|
if params.CamState {
|
||||||
c.subscribeIfNeeded(params.SessionID)
|
c.subscribeIfNeeded(params.SessionID)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
|
|
||||||
|
"whitelist-bypass/relay/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -549,12 +551,16 @@ func (c *SignalingClient) ReadLoop() error {
|
|||||||
}
|
}
|
||||||
var frame Frame
|
var frame Frame
|
||||||
if err := json.Unmarshal(raw, &frame); err != nil {
|
if err := json.Unmarshal(raw, &frame); err != nil {
|
||||||
|
if common.Debug {
|
||||||
c.logFn("dion: drop non-json frame: %v", err)
|
c.logFn("dion: drop non-json frame: %v", err)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if frame.Error != nil {
|
if frame.Error != nil {
|
||||||
|
if common.Debug {
|
||||||
c.logFn("dion: <- %s ERROR code=%d message=%q", frame.Method, frame.Error.Code, frame.Error.Message)
|
c.logFn("dion: <- %s ERROR code=%d message=%q", frame.Method, frame.Error.Code, frame.Error.Message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
c.dispatch(frame)
|
c.dispatch(frame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,9 +367,11 @@ func (c *Client) handleSignal(data []byte) {
|
|||||||
c.OnParticipantUpdate(sr.Participants)
|
c.OnParticipantUpdate(sr.Participants)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
if common.Debug {
|
||||||
c.logFn("[lk] <- signal kind=%d (%d bytes)", sr.Kind, len(data))
|
c.logFn("[lk] <- signal kind=%d (%d bytes)", sr.Kind, len(data))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) applyPubAnswer(sdp string) {
|
func (c *Client) applyPubAnswer(sdp string) {
|
||||||
if c.OnRemoteSDP != nil {
|
if c.OnRemoteSDP != nil {
|
||||||
@@ -476,7 +478,7 @@ func (c *Client) PingLoop() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
sentN++
|
sentN++
|
||||||
if sentN <= 3 || sentN%12 == 0 {
|
if common.Debug && (sentN <= 3 || sentN%12 == 0) {
|
||||||
c.logFn("[lk] ping #%d sent", sentN)
|
c.logFn("[lk] ping #%d sent", sentN)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -741,7 +741,9 @@ func (j *TelemostHeadlessJoiner) handleMessage(raw []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ud, ok := msg["updateDescription"]; ok {
|
if ud, ok := msg["updateDescription"]; ok {
|
||||||
|
if common.Debug {
|
||||||
j.logFn("telemost-joiner: <- updateDescription %s", tmapi.BriefJSON(ud))
|
j.logFn("telemost-joiner: <- updateDescription %s", tmapi.BriefJSON(ud))
|
||||||
|
}
|
||||||
j.ack(uid)
|
j.ack(uid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -753,7 +755,9 @@ func (j *TelemostHeadlessJoiner) handleMessage(raw []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if sc, ok := msg["slotsConfig"]; ok {
|
if sc, ok := msg["slotsConfig"]; ok {
|
||||||
|
if common.Debug {
|
||||||
j.logFn("telemost-joiner: <- slotsConfig %s", tmapi.BriefJSON(sc))
|
j.logFn("telemost-joiner: <- slotsConfig %s", tmapi.BriefJSON(sc))
|
||||||
|
}
|
||||||
needRebind := false
|
needRebind := false
|
||||||
presentPids := make(map[string]bool)
|
presentPids := make(map[string]bool)
|
||||||
for _, ev := range tmapi.SlotsConfigBindings(sc) {
|
for _, ev := range tmapi.SlotsConfigBindings(sc) {
|
||||||
@@ -817,7 +821,9 @@ func (j *TelemostHeadlessJoiner) handleMessage(raw []byte) {
|
|||||||
if k == "uid" || k == "ack" {
|
if k == "uid" || k == "ack" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if common.Debug {
|
||||||
j.logFn("telemost-joiner: <- %s (unhandled) %s", k, tmapi.BriefJSON(v))
|
j.logFn("telemost-joiner: <- %s (unhandled) %s", k, tmapi.BriefJSON(v))
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ func ReadTrack(track *webrtc.TrackRemote, handler func([]byte), logFn func(strin
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
recvCount++
|
recvCount++
|
||||||
if recvCount <= 3 || recvCount%200 == 0 {
|
if common.Debug && (recvCount <= 3 || recvCount%200 == 0) {
|
||||||
logFn("%s: recv vp8 frame #%d %d bytes", prefix, recvCount, len(frameBuf))
|
logFn("%s: recv vp8 frame #%d %d bytes", prefix, recvCount, len(frameBuf))
|
||||||
}
|
}
|
||||||
if handler != nil {
|
if handler != nil {
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ func (c *VKClient) handleMessage(raw []byte) {
|
|||||||
if err := json.Unmarshal(raw, &msg); err != nil {
|
if err := json.Unmarshal(raw, &msg); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if common.Debug {
|
||||||
c.logFn("vk: >> msg type=%s id=%d", msg.Type, msg.ID)
|
c.logFn("vk: >> msg type=%s id=%d", msg.Type, msg.ID)
|
||||||
|
}
|
||||||
|
|
||||||
switch msg.Type {
|
switch msg.Type {
|
||||||
case "ice-servers":
|
case "ice-servers":
|
||||||
@@ -66,8 +68,10 @@ func (c *VKClient) handleMessage(raw []byte) {
|
|||||||
case "close":
|
case "close":
|
||||||
c.cleanup()
|
c.cleanup()
|
||||||
}
|
}
|
||||||
|
if common.Debug {
|
||||||
c.logFn("vk: << msg type=%s id=%d done", msg.Type, msg.ID)
|
c.logFn("vk: << msg type=%s id=%d done", msg.Type, msg.ID)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *VKClient) createPC(config webrtc.Configuration) error {
|
func (c *VKClient) createPC(config webrtc.Configuration) error {
|
||||||
se := webrtc.SettingEngine{}
|
se := webrtc.SettingEngine{}
|
||||||
@@ -96,7 +100,9 @@ func (c *VKClient) createPC(config webrtc.Configuration) error {
|
|||||||
c.logFn("vk: producerNotification DC opened")
|
c.logFn("vk: producerNotification DC opened")
|
||||||
})
|
})
|
||||||
dcNotif.OnMessage(func(msg webrtc.DataChannelMessage) {
|
dcNotif.OnMessage(func(msg webrtc.DataChannelMessage) {
|
||||||
|
if common.Debug {
|
||||||
c.logFn("vk: producerNotification msg len=%d isString=%v", len(msg.Data), msg.IsString)
|
c.logFn("vk: producerNotification msg len=%d isString=%v", len(msg.Data), msg.IsString)
|
||||||
|
}
|
||||||
// Forward to Node bridge as sfu-dc-message
|
// Forward to Node bridge as sfu-dc-message
|
||||||
c.SendToHook("sfu-dc-message", map[string]interface{}{
|
c.SendToHook("sfu-dc-message", map[string]interface{}{
|
||||||
"channel": "producerNotification",
|
"channel": "producerNotification",
|
||||||
@@ -113,7 +119,9 @@ func (c *VKClient) createPC(config webrtc.Configuration) error {
|
|||||||
c.logFn("vk: producerCommand DC opened")
|
c.logFn("vk: producerCommand DC opened")
|
||||||
})
|
})
|
||||||
dcCmd.OnMessage(func(msg webrtc.DataChannelMessage) {
|
dcCmd.OnMessage(func(msg webrtc.DataChannelMessage) {
|
||||||
|
if common.Debug {
|
||||||
c.logFn("vk: producerCommand msg len=%d", len(msg.Data))
|
c.logFn("vk: producerCommand msg len=%d", len(msg.Data))
|
||||||
|
}
|
||||||
c.SendToHook("sfu-dc-message", map[string]interface{}{
|
c.SendToHook("sfu-dc-message", map[string]interface{}{
|
||||||
"channel": "producerCommand",
|
"channel": "producerCommand",
|
||||||
"data": string(msg.Data),
|
"data": string(msg.Data),
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
kcp "github.com/xtaci/kcp-go/v5"
|
kcp "github.com/xtaci/kcp-go/v5"
|
||||||
|
|
||||||
|
"whitelist-bypass/relay/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -383,7 +385,7 @@ func (t *MultiTrackKCPTunnel) updateLoop() {
|
|||||||
session.update()
|
session.update()
|
||||||
}
|
}
|
||||||
ticks++
|
ticks++
|
||||||
if ticks%kcpStatsEvery == 0 && t.logFn != nil {
|
if common.Debug && ticks%kcpStatsEvery == 0 && t.logFn != nil {
|
||||||
t.logFn("kcptunnel: sessions=%d window=%d sent=%d delivered=%d out_segs=%d in_segs=%d raw_out=%d raw_in=%d dropped=%d",
|
t.logFn("kcptunnel: sessions=%d window=%d sent=%d delivered=%d out_segs=%d in_segs=%d raw_out=%d raw_in=%d dropped=%d",
|
||||||
len(sessions), t.currentWindow.Load(), t.sentMessages.Load(), t.deliveredMessages.Load(),
|
len(sessions), t.currentWindow.Load(), t.sentMessages.Load(), t.deliveredMessages.Load(),
|
||||||
t.outputSegments.Load(), t.inputSegments.Load(),
|
t.outputSegments.Load(), t.inputSegments.Load(),
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import (
|
|||||||
"whitelist-bypass/relay/common"
|
"whitelist-bypass/relay/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const acceptErrorRetryDelay = 100 * time.Millisecond
|
||||||
|
|
||||||
type creatorUDP struct {
|
type creatorUDP struct {
|
||||||
direct *net.UDPConn
|
direct *net.UDPConn
|
||||||
socks *common.Socks5UDPSession
|
socks *common.Socks5UDPSession
|
||||||
@@ -549,6 +551,7 @@ func (rb *RelayBridge) ListenSOCKS(addr string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
rb.logFn("relay: accept error: %v", err)
|
rb.logFn("relay: accept error: %v", err)
|
||||||
|
time.Sleep(acceptErrorRetryDelay)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
go rb.handleSOCKS(conn)
|
go rb.handleSOCKS(conn)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"whitelist-bypass/relay/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -134,7 +136,7 @@ func (w *ScreenWriter) emit(msg []byte) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
n := w.sent.Add(1)
|
n := w.sent.Add(1)
|
||||||
if n <= 5 || n%500 == 0 {
|
if common.Debug && (n <= 5 || n%500 == 0) {
|
||||||
w.logFn("[%s] sent frame #%d size=%d", w.label, n, len(msg))
|
w.logFn("[%s] sent frame #%d size=%d", w.label, n, len(msg))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,7 +254,7 @@ func (s *SymmetricScreenTunnel) Stop() {
|
|||||||
func (s *SymmetricScreenTunnel) HandleScreenFrame(frame []byte) {
|
func (s *SymmetricScreenTunnel) HandleScreenFrame(frame []byte) {
|
||||||
res := s.obf.Decode(frame)
|
res := s.obf.Decode(frame)
|
||||||
n := s.recv.Add(1)
|
n := s.recv.Add(1)
|
||||||
if n <= 10 || n%500 == 0 {
|
if common.Debug && (n <= 10 || n%500 == 0) {
|
||||||
s.logFn("screen recv frame #%d in=%d hasFrame=%v keepalive=%v payload=%d", n, len(frame), res.HasFrame, res.Keepalive, len(res.Payload))
|
s.logFn("screen recv frame #%d in=%d hasFrame=%v keepalive=%v payload=%d", n, len(frame), res.HasFrame, res.Keepalive, len(res.Payload))
|
||||||
}
|
}
|
||||||
if !res.HasFrame || res.SelfEcho || res.Keepalive || len(res.Payload) == 0 {
|
if !res.HasFrame || res.SelfEcho || res.Keepalive || len(res.Payload) == 0 {
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ func (t *VP8DataTunnel) writerLoop() {
|
|||||||
if isKeepalive {
|
if isKeepalive {
|
||||||
t.keepaliveFrames.Add(1)
|
t.keepaliveFrames.Add(1)
|
||||||
}
|
}
|
||||||
if n <= 5 || n%500 == 0 {
|
if common.Debug && (n <= 5 || n%500 == 0) {
|
||||||
keepalives := t.keepaliveFrames.Load()
|
keepalives := t.keepaliveFrames.Load()
|
||||||
t.logFn("vp8tunnel: sent frame #%d size=%d data=%d keepalive=%d", n, len(sample), n-keepalives, keepalives)
|
t.logFn("vp8tunnel: sent frame #%d size=%d data=%d keepalive=%d", n, len(sample), n-keepalives, keepalives)
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,7 @@ func (t *VP8DataTunnel) HandleFrame(frame []byte) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
n := t.recvFrames.Add(1)
|
n := t.recvFrames.Add(1)
|
||||||
if n <= 5 || n%500 == 0 {
|
if common.Debug && (n <= 5 || n%500 == 0) {
|
||||||
t.logFn("vp8tunnel: recv frame #%d size=%d", n, len(res.Payload))
|
t.logFn("vp8tunnel: recv frame #%d size=%d", n, len(res.Payload))
|
||||||
}
|
}
|
||||||
if t.OnData != nil {
|
if t.OnData != nil {
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ func (t *VP8LegacyTunnel) writerLoop() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
n := t.sentFrames.Add(1)
|
n := t.sentFrames.Add(1)
|
||||||
if n <= 5 || n%500 == 0 {
|
if common.Debug && (n <= 5 || n%500 == 0) {
|
||||||
t.logFn("vp8tunnel-legacy: sent frame #%d size=%d", n, len(sample))
|
t.logFn("vp8tunnel-legacy: sent frame #%d size=%d", n, len(sample))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,7 +232,7 @@ func (t *VP8LegacyTunnel) HandleFrame(frame []byte) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
n := t.recvFrames.Add(1)
|
n := t.recvFrames.Add(1)
|
||||||
if n <= 5 || n%500 == 0 {
|
if common.Debug && (n <= 5 || n%500 == 0) {
|
||||||
t.logFn("vp8tunnel-legacy: recv frame #%d size=%d", n, len(payload))
|
t.logFn("vp8tunnel-legacy: recv frame #%d size=%d", n, len(payload))
|
||||||
}
|
}
|
||||||
if t.OnData != nil {
|
if t.OnData != nil {
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ func (s *Session) readVP8Track(track *webrtc.TrackRemote) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
recvCount++
|
recvCount++
|
||||||
if recvCount <= 3 || recvCount%200 == 0 {
|
if common.Debug && (recvCount <= 3 || recvCount%200 == 0) {
|
||||||
s.cfg.LogFn("[lk-video] recv vp8 frame #%d %d bytes", recvCount, len(frameBuf))
|
s.cfg.LogFn("[lk-video] recv vp8 frame #%d %d bytes", recvCount, len(frameBuf))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user