Documentation
¶
Index ¶
- Variables
- func DecryptBlocks(b cipher.Block, bs []byte) error
- func EncryptBlocks(b cipher.Block, bs []byte) error
- func GenerateRSAKey(bits int, path string) (*rsa.PrivateKey, error)
- func LoadRSAPrivateKey(path string) (*rsa.PrivateKey, error)
- func LoadRSAPublicKey(path string) (*rsa.PublicKey, error)
- func LoadYamlConfig(path string, obj interface{}) error
- func MakeCryptoKeyIV(password []byte, key_size, iv_size int) ([]byte, []byte)
- func ReadN2(bs []byte, offset int) uint16
- func ReadN4(bs []byte, offset int) uint32
- func WriteN2(bs []byte, offset int, n uint16)
- func WriteN4(bs []byte, offset int, n uint32)
- type AESCipherMaker
- type CipherConfig
- type CipherExchange
- func (ctx *CipherExchange) CalcKey(ef *big.Int)
- func (ctx *CipherExchange) MakeCryptoKeyIV(key_size, iv_size int) ([]byte, []byte)
- func (ctx *CipherExchange) MakeE() (*big.Int, error)
- func (ctx *CipherExchange) MakeEF(minval int64) (*big.Int, error)
- func (ctx *CipherExchange) MakeF() (*big.Int, error)
- func (ctx *CipherExchange) MakeSessionId() (SessionId, error)
- type ClientConfig
- type DESCipherMaker
- type GlobalCipherConfig
- type RetryRequester
- type Server
- type ServerConfig
- type Session
- type SessionId
- type SessionManager
- func (mgr *SessionManager) AutoDelSession()
- func (mgr *SessionManager) DelSession(session *Session)
- func (mgr *SessionManager) DelSessionById(sid SessionId)
- func (mgr *SessionManager) GetSessionByAddr(addr string) *Session
- func (mgr *SessionManager) GetSessionById(sid SessionId) *Session
- func (mgr *SessionManager) NewSession(addr *net.UDPAddr) *Session
- func (mgr *SessionManager) SessionFeedId(session *Session, sid SessionId)
- type TunDev
- type UserConfig
- type UserConfigs
Constants ¶
This section is empty.
Variables ¶
View Source
var InvalidBlockData error = errors.New("invalid block data")
View Source
var RequestTimeout error = errors.New("request timeout")
Functions ¶
func GenerateRSAKey ¶
func GenerateRSAKey(bits int, path string) (*rsa.PrivateKey, error)
func LoadRSAPrivateKey ¶
func LoadRSAPrivateKey(path string) (*rsa.PrivateKey, error)
func LoadYamlConfig ¶
func MakeCryptoKeyIV ¶
Types ¶
type AESCipherMaker ¶
type AESCipherMaker struct{}
type CipherConfig ¶
type CipherConfig struct { Name string KeySize int BlockSize int // contains filtered or unexported fields }
func GetCipherConfig ¶
func GetCipherConfig(name string) *CipherConfig
type CipherExchange ¶
type CipherExchange struct { P *big.Int G int XY *big.Int EF *big.Int Key *big.Int CryptoKey []byte // fixed size key, for cipher IV []byte }
func MakeCipherExchange ¶
func MakeCipherExchange(p *big.Int, g int) *CipherExchange
func NewCipherExchange ¶
func NewCipherExchange(group int) (*CipherExchange, error)
func (*CipherExchange) CalcKey ¶
func (ctx *CipherExchange) CalcKey(ef *big.Int)
func (*CipherExchange) MakeCryptoKeyIV ¶
func (ctx *CipherExchange) MakeCryptoKeyIV(key_size, iv_size int) ([]byte, []byte)
func (*CipherExchange) MakeSessionId ¶
func (ctx *CipherExchange) MakeSessionId() (SessionId, error)
type ClientConfig ¶
type ClientConfig struct { ServerAddr string GlobalEncryptMethod string GlobalEncryptPassword string LinkEncryptMethods []string ServerPublicKeyPath string Username string Password string }
func LoadClientConfig ¶
func LoadClientConfig(path string) (*ClientConfig, error)
type DESCipherMaker ¶
type DESCipherMaker struct {
// contains filtered or unexported fields
}
type GlobalCipherConfig ¶
type GlobalCipherConfig struct { Config *CipherConfig Key []byte }
func LoadGlobalCipherConfig ¶
func LoadGlobalCipherConfig(name string, passwd []byte) (*GlobalCipherConfig, error)
type RetryRequester ¶
type RetryRequester struct {
// contains filtered or unexported fields
}
func NewRetryRequester ¶
func NewRetryRequester(max_retry, timeout int, read, write chan []byte) *RetryRequester
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(cfg *ServerConfig) (*Server, error)
type ServerConfig ¶
type ServerConfig struct { ListenAddr string GlobalEncryptMethod string GlobalEncryptPassword string LinkEncryptMethods []string UserConfigPath string KeyPath string }
func LoadServerConfig ¶
func LoadServerConfig(path string) (*ServerConfig, error)
type Session ¶
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
func NewSessionManager ¶
func NewSessionManager() *SessionManager
func (*SessionManager) AutoDelSession ¶
func (mgr *SessionManager) AutoDelSession()
func (*SessionManager) DelSession ¶
func (mgr *SessionManager) DelSession(session *Session)
func (*SessionManager) DelSessionById ¶
func (mgr *SessionManager) DelSessionById(sid SessionId)
func (*SessionManager) GetSessionByAddr ¶
func (mgr *SessionManager) GetSessionByAddr(addr string) *Session
func (*SessionManager) GetSessionById ¶
func (mgr *SessionManager) GetSessionById(sid SessionId) *Session
func (*SessionManager) NewSession ¶
func (mgr *SessionManager) NewSession(addr *net.UDPAddr) *Session
func (*SessionManager) SessionFeedId ¶
func (mgr *SessionManager) SessionFeedId(session *Session, sid SessionId)
type UserConfig ¶
type UserConfig struct {
Password string
}
type UserConfigs ¶
type UserConfigs struct {
// contains filtered or unexported fields
}
func GetUserConfigs ¶
func GetUserConfigs(path string) (*UserConfigs, error)
func (*UserConfigs) Get ¶
func (cfgs *UserConfigs) Get(user string) *UserConfig
func (*UserConfigs) Reload ¶
func (cfgs *UserConfigs) Reload() error
Click to show internal directories.
Click to hide internal directories.