tunnelBackend/tunnelFrontend -> tcpTunnel (#170)

This commit is contained in:
Michael Quigley 2023-04-18 13:28:15 -04:00
parent 7c01f6d52a
commit 1a38aef26d
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
4 changed files with 14 additions and 14 deletions

View File

@ -2,7 +2,7 @@ package main
import (
httptransport "github.com/go-openapi/runtime/client"
"github.com/openziti/zrok/endpoints/tunnelFrontend"
"github.com/openziti/zrok/endpoints/tcpTunnel"
"github.com/openziti/zrok/rest_client_zrok/share"
"github.com/openziti/zrok/rest_model_zrok"
"github.com/openziti/zrok/tui"
@ -63,7 +63,7 @@ func (cmd *accessPrivateTunnelCommand) run(_ *cobra.Command, args []string) {
}
logrus.Infof("allocated frontend '%v'", accessResp.Payload.FrontendToken)
fe, err := tunnelFrontend.NewFrontend(&tunnelFrontend.Config{
fe, err := tcpTunnel.NewFrontend(&tcpTunnel.FrontendConfig{
BindAddress: cmd.bindAddress,
IdentityName: "backend",
ShrToken: args[0],

View File

@ -7,7 +7,7 @@ import (
httptransport "github.com/go-openapi/runtime/client"
"github.com/openziti/zrok/endpoints"
"github.com/openziti/zrok/endpoints/proxyBackend"
"github.com/openziti/zrok/endpoints/tunnelBackend"
"github.com/openziti/zrok/endpoints/tcpTunnel"
"github.com/openziti/zrok/endpoints/webBackend"
"github.com/openziti/zrok/model"
"github.com/openziti/zrok/rest_client_zrok"
@ -176,7 +176,7 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) {
}
case "tunnel":
cfg := &tunnelBackend.Config{
cfg := &tcpTunnel.BackendConfig{
IdentityPath: zif,
EndpointAddress: target,
ShrToken: resp.Payload.ShrToken,
@ -256,8 +256,8 @@ func (cmd *sharePrivateCommand) webBackendMode(cfg *webBackend.Config) (endpoint
return be, nil
}
func (cmd *sharePrivateCommand) tunnelBackendMode(cfg *tunnelBackend.Config) error {
be, err := tunnelBackend.New(cfg)
func (cmd *sharePrivateCommand) tunnelBackendMode(cfg *tcpTunnel.BackendConfig) error {
be, err := tcpTunnel.NewBackend(cfg)
if err != nil {
return errors.Wrap(err, "error creating tunnel backend")
}

View File

@ -1,4 +1,4 @@
package tunnelBackend
package tcpTunnel
import (
"github.com/openziti/sdk-golang/ziti"
@ -11,18 +11,18 @@ import (
"time"
)
type Config struct {
type BackendConfig struct {
IdentityPath string
EndpointAddress string
ShrToken string
}
type Backend struct {
cfg *Config
cfg *BackendConfig
listener edge.Listener
}
func New(cfg *Config) (*Backend, error) {
func NewBackend(cfg *BackendConfig) (*Backend, error) {
options := ziti.ListenOptions{
ConnectTimeout: 5 * time.Minute,
MaxConnections: 64,

View File

@ -1,4 +1,4 @@
package tunnelFrontend
package tcpTunnel
import (
"github.com/openziti/sdk-golang/ziti"
@ -12,20 +12,20 @@ import (
"io"
)
type Config struct {
type FrontendConfig struct {
BindAddress string
IdentityName string
ShrToken string
}
type Frontend struct {
cfg *Config
cfg *FrontendConfig
zCtx ziti.Context
listener transport.Address
closer io.Closer
}
func NewFrontend(cfg *Config) (*Frontend, error) {
func NewFrontend(cfg *FrontendConfig) (*Frontend, error) {
addr, err := transport.ParseAddress(cfg.BindAddress)
if err != nil {
return nil, errors.Wrapf(err, "error parsing '%v'", cfg.BindAddress)