go_share_wan_core

package module
v0.0.0-...-47858ad Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: MIT Imports: 9 Imported by: 0

README

go-share-wan-core

异地组网工具,核心包.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePassword

func GeneratePassword() string

func ListenSecureTCP

func ListenSecureTCP(laddr *net.TCPAddr, cipher *Cipher, handleConn func(localConn *SecureTCPConn), didListen func(listenAddr net.Addr)) error

Types

type Cipher

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

func NewCipher

func NewCipher(encodePassword *Password) *Cipher

新建一个编码解码器

func (*Cipher) Decode

func (cipher *Cipher) Decode(bs []byte)

解码加密后的数据到原数据

func (*Cipher) Encode

func (cipher *Cipher) Encode(bs []byte)

加密原数据

type Password

type Password [passwordLength]byte

func ParsePassword

func ParsePassword(passwordString string) (*Password, error)

func (*Password) String

func (password *Password) String() string

type SecureTCPConn

type SecureTCPConn struct {
	io.ReadWriteCloser
	Cipher *Cipher
}

func DialTCPSecure

func DialTCPSecure(raddr *net.TCPAddr, cipher *Cipher) (*SecureTCPConn, error)

func (*SecureTCPConn) DecodeCopy

func (secureSocket *SecureTCPConn) DecodeCopy(dst io.Writer) error

func (*SecureTCPConn) DecodeRead

func (secureSocket *SecureTCPConn) DecodeRead(bs []byte) (n int, err error)

func (*SecureTCPConn) EncodeCopy

func (secureSocket *SecureTCPConn) EncodeCopy(dst io.ReadWriteCloser) error

func (*SecureTCPConn) EncodeWrite

func (secureSocket *SecureTCPConn) EncodeWrite(bs []byte) (int, error)

Jump to

Keyboard shortcuts

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