cybertunnel

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchExternalIP

func FetchExternalIP() (net.IP, error)

func GetClient

func GetClient(ctx context.Context, addr, secret string) (context.Context, tpb.TunnelClient, *grpc.ClientConn, error)

func GetDNSLogClient

func GetDNSLogClient(addr string) (tpb.DNSLogClient, *grpc.ClientConn, error)

func GetTunnelServerCommandCli

func GetTunnelServerCommandCli() *cli.App

func GetTunnelServerExternalIP

func GetTunnelServerExternalIP(addr string, secret string) (net.IP, error)

func HoldingCreateTunnelClient

func HoldingCreateTunnelClient(
	client tpb.Tunnel_CreateTunnelClient,
	localhost string, localport int,
	remoteport int, id string,
	fs ...func(remote, local string)) error

func MirrorLocalPortToRemote

func MirrorLocalPortToRemote(
	network string,
	localPort int,
	remotePort int,
	id string,
	addr,
	secret string,
	ctx context.Context,
	fs ...func(remoteAddr string, localAddr string),
) error

func MirrorLocalPortToRemoteEx

func MirrorLocalPortToRemoteEx(
	network string,
	localHost string,
	localPort int,
	remotePort int,
	id string,
	addr,
	secret string,
	ctx context.Context,
	fs ...func(remoteAddr string, localAddr string),
) error

func MirrorLocalPortToRemoteWithRegisterEx

func MirrorLocalPortToRemoteWithRegisterEx(
	enableRegister bool,
	pubKey []byte,
	grpcSecret string,
	verbose string,

	network string,
	localHost string,
	localPort int,
	remotePort int,
	id string,
	addr,
	secret string,
	ctx context.Context,
	fs ...func(remoteAddr string, localAddr string),
) (fErr error)

func QueryExistedDNSLogEvents

func QueryExistedDNSLogEvents(addr string, token string) ([]*tpb.DNSLogEvent, error)

func QueryExistedDNSLogEventsEx added in v1.2.2

func QueryExistedDNSLogEventsEx(addr string, token string, timeout ...float64) ([]*tpb.DNSLogEvent, error)

func QueryExistedRandomPortTriggerEvents

func QueryExistedRandomPortTriggerEvents(token, addr, secret string, ctx context.Context) (*tpb.RandomPortTriggerEvent, error)

func QueryICMPLengthTriggerNotifications

func QueryICMPLengthTriggerNotifications(length int, addr, secret string, ctx context.Context) (*tpb.ICMPTriggerNotification, error)

func RemoveTunnel

func RemoveTunnel(id string)

func RequireDNSLogDomain

func RequireDNSLogDomain(addr string) (domain string, token string, _ error)

func RequirePortByToken

func RequirePortByToken(
	token string,
	addr, secret string,
	ctx context.Context,
) (*tpb.RequireRandomPortTriggerResponse, error)

Types

type ICMPTrigger

type ICMPTrigger struct {
	// contains filtered or unexported fields
}

func NewICMPTrigger

func NewICMPTrigger() (*ICMPTrigger, error)

func (*ICMPTrigger) GetICMPTriggerNotification

func (p *ICMPTrigger) GetICMPTriggerNotification(i int) (*ICMPTriggerNotification, error)

func (*ICMPTrigger) Run

func (p *ICMPTrigger) Run() error

type ICMPTriggerNotification

type ICMPTriggerNotification struct {
	Size                               int
	CurrentRemoteAddr                  string
	Histories                          []string
	CurrentRemoteCachedConnectionCount int
	SizeCachedHistoryConnectionCount   int
	TriggerTimestamp                   int64
	Timestamp                          int64
}

func (*ICMPTriggerNotification) Show

func (t *ICMPTriggerNotification) Show()

type RandomPortTrigger

type RandomPortTrigger struct {
	// contains filtered or unexported fields
}

func NewRandomPortTrigger

func NewRandomPortTrigger() (*RandomPortTrigger, error)

func (*RandomPortTrigger) GetTriggerNotification

func (p *RandomPortTrigger) GetTriggerNotification(port int) (*TriggerNotification, error)

func (*RandomPortTrigger) Run

func (p *RandomPortTrigger) Run() error

type TriggerNotification

type TriggerNotification struct {
	LocalPort                             int
	CurrentRemoteAddr                     string
	Histories                             []string
	CurrentRemoteCachedConnectionCount    int
	LocalPortCachedHistoryConnectionCount int
	TriggerTimestamp                      int64
	Timestamp                             int64
}

func (*TriggerNotification) Show

func (t *TriggerNotification) Show()

type Tunnel

type Tunnel struct {
	Id string

	Host         string
	Port         int
	PublicKeyPEM []byte
	Secret       string
	Verbose      string

	// finished / registered / working
	Status string
}

func GetTunnel

func GetTunnel(id string) (*Tunnel, error)

func GetTunnels

func GetTunnels() []*Tunnel

func NewTunnel

func NewTunnel(id string, host string, port int, pub []byte, secret string, verbose string) *Tunnel

func (*Tunnel) GetAuth

func (t *Tunnel) GetAuth() []byte

type TunnelClientConn

type TunnelClientConn struct {
	// contains filtered or unexported fields
}

func NewTunnelClientConn

func NewTunnelClientConn(id string, remoteAddr string, reader chan []byte, stream tpb.Tunnel_CreateTunnelClient) *TunnelClientConn

func (*TunnelClientConn) Close

func (s *TunnelClientConn) Close() error

func (*TunnelClientConn) Read

func (c *TunnelClientConn) Read(b []byte) (n int, err error)

func (*TunnelClientConn) Write

func (s *TunnelClientConn) Write(b []byte) (int, error)

type TunnelServer

type TunnelServer struct {
	tpb.TunnelServer

	ExternalIP string

	// 二级密码是用来分别
	SecondaryPassword string
}

func NewTunnelServer

func NewTunnelServer() (*TunnelServer, error)

func (*TunnelServer) CreateTunnel

func (s *TunnelServer) CreateTunnel(server tpb.Tunnel_CreateTunnelServer) error

func (*TunnelServer) GetAllRegisteredTunnel

func (*TunnelServer) GetRegisteredTunnelDescriptionByID

func (t *TunnelServer) GetRegisteredTunnelDescriptionByID(ctx context.Context, req *tpb.GetRegisteredTunnelDescriptionByIDRequest) (*tpb.RegisteredTunnel, error)

func (*TunnelServer) InitialReverseTrigger

func (s *TunnelServer) InitialReverseTrigger() error

func (*TunnelServer) QueryExistedDNSLog

func (*TunnelServer) RegisterTunnel

func (*TunnelServer) RemoteIP

func (s *TunnelServer) RemoteIP(ctx context.Context, req *tpb.Empty) (*tpb.RemoteIPResponse, error)

func (*TunnelServer) RequireDomain

type TunnelServerConn

type TunnelServerConn struct {
	io.ReadWriteCloser
	// contains filtered or unexported fields
}

func NewTunnelServerConn

func NewTunnelServerConn(id string, desc *connectionDesc, stream tpb.Tunnel_CreateTunnelServer) *TunnelServerConn

func (*TunnelServerConn) Close

func (s *TunnelServerConn) Close() error

func (*TunnelServerConn) Read

func (c *TunnelServerConn) Read(b []byte) (n int, err error)

func (*TunnelServerConn) Write

func (s *TunnelServerConn) Write(b []byte) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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