cmd

package
v0.0.39 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ProdEnv indicates if it is in a production env.
	ProdEnv = true
)
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 Examine added in v0.0.39

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

Examine probes on `Address` and prints its status.

func ExamineWithTimeout added in v0.0.39

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

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

func Execute

func Execute()

Execute is the cmd entry.

func ForwardTCP added in v0.0.37

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

ForwardTCP forwards requests from `LocalListener` to `RemoteAddr`.

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 GenerateEd25519 added in v0.0.39

func GenerateEd25519()

GenerateEd25519 creates a pair of Ed25519 and output to console.

func GenerateToken added in v0.0.39

func GenerateToken() error

GenerateToken generates a pair of tokens for webhook authentication to output.

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 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 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 StartProxyClient added in v0.0.39

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

StartProxyClient creates a local socks5 service, and forward traffic to proxy server on `Channel`.

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 StartProxyForwarding added in v0.0.37

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

StartProxyForwarding mounts a channel to a local address.

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 ClientSession added in v0.0.34

type ClientSession struct {
	Conn io.ReadWriteCloser
}

ClientSession abtracts all the operations on a client connection.

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