common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt64

func BytesToInt64(buf []byte) int64

func ConnEncrypt

func ConnEncrypt(conn net.Conn, metakey []byte, cipherID int) (*es.EncryptedStream, error)

func DecrptogRSA

func DecrptogRSA(src []byte, privateKey *rsa.PrivateKey) (res []byte, err error)

DecrptogRSA 对数据进行解密操作

func EncyptogRSA

func EncyptogRSA(src []byte, publicKey *rsa.PublicKey) (res []byte, err error)

EncyptogRSA 对数据进行加密操作

func Int64ToBytes

func Int64ToBytes(i int64) []byte

func ListCipher

func ListCipher() []string

func LoadCipher

func LoadCipher(cipher string) (int, error)

func LoadPrivateKey

func LoadPrivateKey(path string) (privateKey *rsa.PrivateKey, err error)

func LoadPublicKey

func LoadPublicKey(path string) (publicKey *rsa.PublicKey, err error)

func NewChaCha20Poly1305Cipher

func NewChaCha20Poly1305Cipher(key []byte) (*es.CryptoAEADCipher, error)

func NewXChaCha20Poly1305Cipher

func NewXChaCha20Poly1305Cipher(key []byte) (*es.CryptoAEADCipher, error)

func RSAGenKey

func RSAGenKey(bits int, who string) error

func Socks5DstAddrPort

func Socks5DstAddrPort(buf []byte) (*net.TCPAddr, error)

func Socks5Forward

func Socks5Forward(srcConn, dstConn io.ReadWriter)

Types

type Config

type Config struct {
	Client     string
	Server     string
	Cipher     string
	PrivateKey string
	PublicKey  string
}

func (*Config) NewNothing

func (c *Config) NewNothing() (n *Nothing, err error)

type Nid

type Nid [12]byte

func NewNid

func NewNid() Nid

func (*Nid) UnixNano

func (n *Nid) UnixNano() int64

type Nothing

type Nothing struct {
	LocalAddr  *net.TCPAddr
	ServerAddr *net.TCPAddr
	CipherID   int
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

Jump to

Keyboard shortcuts

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