archie-agent relay listens on the sandbox's isolated network and joins every connection to one fixed target, the proxy. The relay holds no secrets and can reach nothing else, so the host needs no address on a sandbox network at all.
19 lines
443 B
Go
19 lines
443 B
Go
package agentworker
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
"github.com/samcharles93/archie-core/internal/infrastructure/egress/relay"
|
|
)
|
|
|
|
// RunRelay listens on listen and forwards every connection to target, the
|
|
// egress proxy, until ctx is cancelled.
|
|
func RunRelay(ctx context.Context, listen, target string) error {
|
|
ln, err := (&net.ListenConfig{}).Listen(ctx, "tcp", listen)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return relay.Serve(ctx, ln, target)
|
|
}
|