cmd

package
v0.0.35-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the version number of this program, should be populated while building.
	Version string
)

Functions

func AddCertPermission added in v0.0.16

func AddCertPermission(KeyFile, CertFile, TokenFile string, in *os.File) error

AddCertPermission adds a new ACL rule into `TokenFile` for clients using `CertFile` and `KeyFile`.

func Execute

func Execute()

Execute is the cmd entry.

func GenerateCA added in v0.0.16

func GenerateCA(CertName string, OutputFolder string, Length int) error

GenerateCA generates a CA with `CertName` as its common name, and stores `ca.key` and `ca.cert` into `OutputFolder`.

func GenerateCertificate added in v0.0.16

func GenerateCertificate(CertName string, DNSName string, CAFolder string, OutputFolder string, Length int) error

GenerateCertificate generates a certificate signed by CA stored in `CAFolder`.

func GenerateConfigToFolder added in v0.0.16

func GenerateConfigToFolder(RouterAddress string, CAFolder string, ServerDNS string, TokenFile string, OutputFolder string, ConfigBaseFolderOverride string, Length int, RouterName string) error

GenerateConfigToFolder generates configs into the Output folder.

func GenerateConfigZip added in v0.0.16

func GenerateConfigZip(RouterAddress string, CAFolder string, ServerDNS string, TokenFile string, ConfigFile string, ConfigBaseFolderOverride string, Length int, RouterName string) error

GenerateConfigZip generates a zip file including a whole set of configuration required to connect to yukino-net.

func GenerateWebhookHashToken added in v0.0.16

func GenerateWebhookHashToken(Token string) string

GenerateWebhookHashToken creates a salted token as a webhook server side token.

func InvokeEndpointService added in v0.0.16

func InvokeEndpointService(ctx context.Context, NetConfig *util.ClientConfig, Channel string, Command []string, PrivateKey string, timeout time.Duration) (string, error)

InvokeEndpointService invokes an endpoint service serving on `Channel`. `PrivateKey` can be empty if authenticaiton is not set on the server side.

func MountBatch added in v0.0.28

func MountBatch(RuntimeContext context.Context, NetConfig *util.ClientConfig, BatchConfigFile string) error

MountBatch parses a config file in format `BatchMountConfig`. And do a series of mounting operations.

func MountLoadBalancing added in v0.0.25

func MountLoadBalancing(RuntimeContext context.Context, NetConfig *util.ClientConfig, Channel string, RemoteChannel []string) error

MountLoadBalancing evenly distributes connections from `Channel` to `RemoteChannel`.

func MountLocal added in v0.0.16

func MountLocal(RuntimeContext context.Context, NetConfig *util.ClientConfig, Channel, LocalAddr string) error

MountLocal mountes a channel to a local address.

func MountLocalListener added in v0.0.16

func MountLocalListener(RuntimeContext context.Context, NetConfig *util.ClientConfig, Channel string, LocalListener net.Listener) error

MountLocalListener mounts a channel to a listener.

func MountRemote added in v0.0.16

func MountRemote(RuntimeContext context.Context, NetConfig *util.ClientConfig, Channel, RemoteAddr string) error

MountRemote mountes a remote address as a `channel` on yukino-net.

func PrepareConfigFiles added in v0.0.16

func PrepareConfigFiles(RouterAddress string, CAFolder string, ServerDNS string, TokenFile string, ConfigBaseFolderOverride string, Length int, RouterCertName string) (map[string][]byte, string, error)

PrepareConfigFiles generates a config set in map[filename] = filedata format.

func Probe added in v0.0.25

func Probe(ctx context.Context, NetConfig *util.ClientConfig, Address string) error

Probe probes on `Address` and prints its status.

func ProbeWithTimeout added in v0.0.34

func ProbeWithTimeout(ctx context.Context, NetConfig *util.ClientConfig, Address string, Timeout time.Duration) error

ProbeWithTimeout keeps trying to probe `Channel` until `Timeout`. If it will return nil immeidately on probing succeed.

func StartDynamicProxy added in v0.0.34

func StartDynamicProxy(RuntimeContext context.Context, NetConfig *util.ClientConfig, Channel string) error

StartDynamicProxy creates a dynamic proxy server for the client to do TCP/UDP proxy requests.

func StartEndpointService added in v0.0.16

func StartEndpointService(ctx context.Context, NetConfig *util.ClientConfig, Channel string, ACL []string, BaseCommand string) error

StartEndpointService starts an endpoint service listening on `Channel`.

func StartEndpointWebhookProxy added in v0.0.16

func StartEndpointWebhookProxy(ctx context.Context, NetConfig *util.ClientConfig, LocalAddr, HashToken string) error

StartEndpointWebhookProxy creates a web service that can proxy an endpoint invoke.

func StartProxyClientWithListener added in v0.0.34

func StartProxyClientWithListener(RuntimeContext context.Context, NetConfig *util.ClientConfig, Channel string, LocalAddress string, listener net.Listener) error

StartProxyClientWithListener starts a socks5 proxy on `listener`.

func StartRouter added in v0.0.16

func StartRouter(NetConfig *util.ClientConfig, AddressOverride string) error

StartRouter creates a router service.

func StartRouterWithListener added in v0.0.35

func StartRouterWithListener(listener net.Listener, TokenFile string, TLSConfig *tls.Config) error

StartRouterWithListener applies a

Types

type BatchMountConfig added in v0.0.28

type BatchMountConfig struct {
	MountConfigs        []MountConfig         `json:"mount-configs"`
	LoadBalancingConfig []LoadBalancingConfig `json:"load-balancers"`
}

BatchMountConfig specifies a local file to define a set of operations.

type ClientSession added in v0.0.34

type ClientSession struct {
	Conn io.ReadWriteCloser
}

ClientSession abtracts all the operations on a client connection.

type LoadBalancingConfig added in v0.0.28

type LoadBalancingConfig struct {
	LoadBalancingChannel string   `json:"load-balancer-channel"`
	Channels             []string `json:"channels"`
}

LoadBalancingConfig specifies a load balancer above channels.

type MountConfig added in v0.0.28

type MountConfig struct {
	Channel string `json:"channel"`
	Address string `json:"address"`
	// Should only be `remote` or `local`.
	Type string `json:"type"`
}

MountConfig specifies a mount option.

type ProxyRequest added in v0.0.34

type ProxyRequest struct {
	Method string
	Target string
}

ProxyRequest defines a request structure by proxy client.

type ProxyResponse added in v0.0.34

type ProxyResponse struct {
	Success bool
	Payload string
}

ProxyResponse defines a response structure by proxy server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL