fix vpn notification, add more logs under debug flag
This commit is contained in:
1 parent
d66be97922
commit
2dbc6ea1eb
17 files changed
+90
-27
No files matched your search
@@ -7,6 +7,8 @@ import (
|
||||
"time"
|
||||
|
||||
kcp "github.com/xtaci/kcp-go/v5"
|
||||
|
||||
"whitelist-bypass/relay/common"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -383,7 +385,7 @@ func (t *MultiTrackKCPTunnel) updateLoop() {
|
||||
session.update()
|
||||
}
|
||||
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",
|
||||
len(sessions), t.currentWindow.Load(), t.sentMessages.Load(), t.deliveredMessages.Load(),
|
||||
t.outputSegments.Load(), t.inputSegments.Load(),
|
||||
|
||||
@@ -15,6 +15,8 @@ import (
|
||||
"whitelist-bypass/relay/common"
|
||||
)
|
||||
|
||||
const acceptErrorRetryDelay = 100 * time.Millisecond
|
||||
|
||||
type creatorUDP struct {
|
||||
direct *net.UDPConn
|
||||
socks *common.Socks5UDPSession
|
||||
@@ -549,6 +551,7 @@ func (rb *RelayBridge) ListenSOCKS(addr string) error {
|
||||
return nil
|
||||
}
|
||||
rb.logFn("relay: accept error: %v", err)
|
||||
time.Sleep(acceptErrorRetryDelay)
|
||||
continue
|
||||
}
|
||||
go rb.handleSOCKS(conn)
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"whitelist-bypass/relay/common"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -134,7 +136,7 @@ func (w *ScreenWriter) emit(msg []byte) {
|
||||
return
|
||||
}
|
||||
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))
|
||||
}
|
||||
}
|
||||
@@ -252,7 +254,7 @@ func (s *SymmetricScreenTunnel) Stop() {
|
||||
func (s *SymmetricScreenTunnel) HandleScreenFrame(frame []byte) {
|
||||
res := s.obf.Decode(frame)
|
||||
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))
|
||||
}
|
||||
if !res.HasFrame || res.SelfEcho || res.Keepalive || len(res.Payload) == 0 {
|
||||
|
||||
@@ -221,7 +221,7 @@ func (t *VP8DataTunnel) writerLoop() {
|
||||
if isKeepalive {
|
||||
t.keepaliveFrames.Add(1)
|
||||
}
|
||||
if n <= 5 || n%500 == 0 {
|
||||
if common.Debug && (n <= 5 || n%500 == 0) {
|
||||
keepalives := t.keepaliveFrames.Load()
|
||||
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
|
||||
}
|
||||
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))
|
||||
}
|
||||
if t.OnData != nil {
|
||||
|
||||
@@ -198,7 +198,7 @@ func (t *VP8LegacyTunnel) writerLoop() {
|
||||
continue
|
||||
}
|
||||
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))
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ func (t *VP8LegacyTunnel) HandleFrame(frame []byte) {
|
||||
return
|
||||
}
|
||||
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))
|
||||
}
|
||||
if t.OnData != nil {
|
||||
|
||||
Reference in new issue
Block a user