mirror of
https://github.com/openziti/zrok.git
synced 2024-11-22 16:13:47 +01:00
tunnelBackend/tunnelFrontend -> tcpTunnel (#170)
This commit is contained in:
parent
7c01f6d52a
commit
1a38aef26d
@ -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],
|
||||
|
@ -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")
|
||||
}
|
||||
|
@ -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,
|
@ -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)
|
Loading…
Reference in New Issue
Block a user