Documentation
¶
Index ¶
- func ParsePassword(passwordString string) (*password, error)
- func RandPassword() string
- func WrapConn(rawConn net.Conn, cipher *Cipher) (net.Conn, error)
- func WrapListener(lis net.Listener, cipher *Cipher) net.Listener
- type Cipher
- type Listener
- type SecureConn
- func (c *SecureConn) Close() error
- func (c *SecureConn) LocalAddr() net.Addr
- func (c *SecureConn) Read(b []byte) (n int, err error)
- func (c *SecureConn) RemoteAddr() net.Addr
- func (c *SecureConn) SetDeadline(t time.Time) error
- func (c *SecureConn) SetReadDeadline(t time.Time) error
- func (c *SecureConn) SetWriteDeadline(t time.Time) error
- func (c *SecureConn) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParsePassword ¶
解析采用base64编码的字符串获取密码
func RandPassword ¶
func RandPassword() string
产生 256个byte随机组合的 密码,最后会使用base64编码为字符串存储在配置文件中 不能出现任何一个重复的byte位,必须又 0-255 组成,并且都需要包含
Types ¶
type SecureConn ¶
type SecureConn struct {
// contains filtered or unexported fields
}
const (
bufSize = 1024
)
var bpool sync.Pool
func init() { bpool.New = func() interface{} { return make([]byte, bufSize) } }
func bufferPoolGet() []byte { return bpool.Get().([]byte) }
func bufferPoolPut(b []byte) { bpool.Put(b) }
加密传输的 Socket
func (*SecureConn) Close ¶
func (c *SecureConn) Close() error
func (*SecureConn) LocalAddr ¶
func (c *SecureConn) LocalAddr() net.Addr
func (*SecureConn) Read ¶
func (c *SecureConn) Read(b []byte) (n int, err error)
从输入流里读取加密过的数据,解密后把原数据放到bs里
func (*SecureConn) RemoteAddr ¶
func (c *SecureConn) RemoteAddr() net.Addr
func (*SecureConn) SetDeadline ¶
func (c *SecureConn) SetDeadline(t time.Time) error
func (*SecureConn) SetReadDeadline ¶
func (c *SecureConn) SetReadDeadline(t time.Time) error
func (*SecureConn) SetWriteDeadline ¶
func (c *SecureConn) SetWriteDeadline(t time.Time) error
Click to show internal directories.
Click to hide internal directories.