Skip to content

Commit

Permalink
wiresocks: pass logger to ipscanner
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Pashmfouroush <[email protected]>
  • Loading branch information
markpash committed Mar 21, 2024
1 parent 3cd95df commit cbc22b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func RunWarp(ctx context.Context, l *slog.Logger, opts WarpOptions) error {
endpoints := []string{opts.Endpoint, opts.Endpoint}

if opts.Scan != nil {
res, err := wiresocks.RunScan(ctx, *opts.Scan)
res, err := wiresocks.RunScan(ctx, l, *opts.Scan)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion ipscanner/internal/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewScannerEngine(opts *statute.ScannerOptions) *Engine {
ipQueue: queue,
ping: p.DoPing,
generator: iterator.NewIterator(opts),
log: opts.Logger.With(slog.String("subsystem", "engine")),
log: opts.Logger.With(slog.String("subsystem", "scanner/engine")),
}
}

Expand Down
4 changes: 3 additions & 1 deletion wiresocks/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"time"

"github.com/bepass-org/warp-plus/ipscanner"
Expand All @@ -17,7 +18,7 @@ type ScanOptions struct {
MaxRTT time.Duration
}

func RunScan(ctx context.Context, opts ScanOptions) (result []ipscanner.IPInfo, err error) {
func RunScan(ctx context.Context, l *slog.Logger, opts ScanOptions) (result []ipscanner.IPInfo, err error) {
cfg, err := ini.Load("./primary/wgcf-profile.ini")
if err != nil {
return nil, fmt.Errorf("failed to read file: %w", err)
Expand All @@ -31,6 +32,7 @@ func RunScan(ctx context.Context, opts ScanOptions) (result []ipscanner.IPInfo,

// new scanner
scanner := ipscanner.NewScanner(
ipscanner.WithLogger(l.With(slog.String("subsystem", "scanner"))),
ipscanner.WithWarpPing(),
ipscanner.WithWarpPrivateKey(privateKey),
ipscanner.WithWarpPeerPublicKey(publicKey),
Expand Down

0 comments on commit cbc22b6

Please sign in to comment.