lightsocks: github.com/gwuhaolin/lightsocks Index | Files | Directories

package lightsocks

import "github.com/gwuhaolin/lightsocks"

Index

Package Files

cipher.go password.go securetcp.go

func ListenEncryptedTCP Uses

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

see net.ListenTCP

func ParsePassword Uses

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

解析采用base64编码的字符串获取密码

func RandPassword Uses

func RandPassword() string

产生 256个byte随机组合的 密码,最后会使用base64编码为字符串存储在配置文件中 不能出现任何一个重复的byte位,必须又 0-255 组成,并且都需要包含

type Cipher Uses

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

func NewCipher Uses

func NewCipher(encodePassword *password) *Cipher

新建一个编码解码器

func (*Cipher) Decode Uses

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

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

func (*Cipher) Encode Uses

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

加密原数据

type SecureTCPConn Uses

type SecureTCPConn struct {
    io.ReadWriteCloser
    Cipher *Cipher
}

加密传输的 TCP Socket

func DialEncryptedTCP Uses

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

see net.DialTCP

func (*SecureTCPConn) DecodeCopy Uses

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

从src中源源不断的读取加密后的数据解密后写入到dst,直到src中没有数据可以再读取

func (*SecureTCPConn) DecodeRead Uses

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

从输入流里读取加密过的数据,解密后把原数据放到bs里

func (*SecureTCPConn) EncodeCopy Uses

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

从src中源源不断的读取原数据加密后写入到dst,直到src中没有数据可以再读取

func (*SecureTCPConn) EncodeWrite Uses

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

把放在bs里的数据加密后立即全部写入输出流

Directories

PathSynopsis
cmd
cmd/lightsocks-local
cmd/lightsocks-server
local
local/tun
server

Package lightsocks imports 9 packages (graph) and is imported by 3 packages. Updated 2020-12-26. Refresh now. Tools for package owners.