Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a86d0d

Browse files
committed
chore(vpn): send info, debug logs over tunnel
1 parent208fcc2 commit0a86d0d

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

‎cli/vpndaemon_windows.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func (r *RootCmd) vpnDaemonRun() *serpent.Command {
6565
logger.Info(ctx,"starting tunnel")
6666
tunnel,err:=vpn.NewTunnel(ctx,logger,pipe,vpn.NewClient(),
6767
vpn.UseOSNetworkingStack(),
68-
vpn.UseAsLogger(),
6968
vpn.UseCustomLogSinks(sinks...),
7069
)
7170
iferr!=nil {

‎vpn/dylib/lib.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ func OpenTunnel(cReadFD, cWriteFD int32) int32 {
4646
returnErrOpenPipe
4747
}
4848

49-
_,err=vpn.NewTunnel(ctx,slog.Make(),conn,vpn.NewClient(),
49+
// We log everything, as filtering is done by whatever renders the OS
50+
// logs.
51+
_,err=vpn.NewTunnel(ctx,slog.Make().Leveled(slog.LevelDebug),conn,
52+
vpn.NewClient(),
5053
vpn.UseOSNetworkingStack(),
5154
vpn.UseAsLogger(),
5255
)

‎vpn/tunnel.go

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ type Tunnel struct {
4646

4747
logger slog.Logger
4848

49-
logMu sync.Mutex
50-
logs []*TunnelMessage
51-
5249
clientClient
5350

5451
// clientLogger is a separate logger than `logger` when the `UseAsLogger`
@@ -300,29 +297,22 @@ func (t *Tunnel) stop(*StopRequest) error {
300297
var_ slog.Sink=&Tunnel{}
301298

302299
func (t*Tunnel)LogEntry(_ context.Context,e slog.SinkEntry) {
303-
t.logMu.Lock()
304-
defert.logMu.Unlock()
305-
t.logs=append(t.logs,&TunnelMessage{
300+
msg:=&TunnelMessage{
306301
Msg:&TunnelMessage_Log{
307302
Log:sinkEntryToPb(e),
308303
},
309-
})
310-
}
311-
312-
func (t*Tunnel)Sync() {
313-
t.logMu.Lock()
314-
logs:=t.logs
315-
t.logs=nil
316-
t.logMu.Unlock()
317-
for_,msg:=rangelogs {
318-
select {
319-
case<-t.ctx.Done():
320-
return
321-
caset.sendCh<-msg:
322-
}
304+
}
305+
select {
306+
case<-t.updater.ctx.Done():
307+
return
308+
case<-t.ctx.Done():
309+
return
310+
caset.sendCh<-msg:
323311
}
324312
}
325313

314+
func (t*Tunnel)Sync() {}
315+
326316
funcsinkEntryToPb(e slog.SinkEntry)*Log {
327317
l:=&Log{
328318
// #nosec G115 - Safe conversion for log levels which are small positive integers
@@ -583,6 +573,8 @@ func (u *updater) sendAgentUpdate() {
583573
return
584574
}
585575

576+
u.logger.Debug(u.ctx,"sending agent update")
577+
586578
msg:=&TunnelMessage{
587579
Msg:&TunnelMessage_PeerUpdate{
588580
PeerUpdate:&PeerUpdate{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp