chore: tunnel recorder & slight refactor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-09-27 17:49:59 -04:00
parent 20c1388cf4
commit 0722e5f032
17 changed files with 725 additions and 285 deletions

View File

@@ -1,10 +1,13 @@
package cmd
import (
"context"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"reichard.io/conduit/client"
"reichard.io/conduit/config"
"reichard.io/conduit/store"
"reichard.io/conduit/tunnel"
)
var tunnelCmd = &cobra.Command{
@@ -17,12 +20,22 @@ var tunnelCmd = &cobra.Command{
log.Fatal("failed to get client config:", err)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// Create Forwarder
tunnelForwarder, err := tunnel.NewForwarder(cfg.TunnelTarget, store.NewTunnelStore(100))
if err != nil {
log.Fatal("failed to create tunnel forwarder:", err)
}
go tunnelForwarder.Start(ctx)
// Create Tunnel
tunnel, err := client.NewTunnel(cfg)
tunnel, err := tunnel.NewClientTunnel(cfg, tunnelForwarder)
if err != nil {
log.Fatal("failed to create tunnel:", err)
}
tunnel.Start()
tunnel.Start(ctx)
},
}