Documentation
¶
Index ¶
- Constants
- Variables
- func AddTrustedCert(vkey string, fp []byte)
- func AesDecrypt(crypted, key []byte) ([]byte, error)
- func AesEncrypt(origData, key []byte) ([]byte, error)
- func Blake2b(s string) string
- func BuildTotpUri(issuer, accountName, secret string) string
- func ComputeHMAC(passwd string, timestamp int64, randomDataPieces ...[]byte) []byte
- func DecryptBytes(enc []byte, keyStr string) ([]byte, error)
- func DecryptStringWithPrivateKey(base64Cipher string) (string, error)
- func DecryptWithPrivateKey(base64Cipher string) ([]byte, error)
- func EncryptBytes(data []byte, keyStr string) ([]byte, error)
- func FNV1a64(parts ...string) string
- func GenerateTOTPSecret() (string, error)
- func GenerateUUID(nameParts ...string) uuid.UUID
- func GetCert() tls.Certificate
- func GetCertCfg() *tls.Config
- func GetCertFingerprint(certificate tls.Certificate) []byte
- func GetFakeDomainName() string
- func GetHMAC(passwd string, data ...[]byte) []byte
- func GetPublicKeyPEM() (string, error)
- func GetRSAPublicKeyPEM() (string, error)
- func GetRandomString(l int, id ...int) string
- func GetTOTPCode(secret string) (string, int64, error)
- func GetUUID() uuid.UUID
- func InitTls(customCert tls.Certificate)
- func IsValidTOTPSecret(secret string) bool
- func Md5(s string) string
- func NewTlsClientConn(conn net.Conn) net.Conn
- func NewTlsServerConn(conn net.Conn) net.Conn
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) (error, []byte)
- func PrintTOTPCode(secret string)
- func PrintTOTPSecret()
- func ReadClientHello(clientConn net.Conn, prefix []byte) (helloInfo *tls.ClientHelloInfo, rawData []byte, err error)
- func ValidateTOTPCode(secret, code string) (bool, error)
- type LoginPayload
- type ReadOnlyConn
- func (c *ReadOnlyConn) Close() error
- func (c *ReadOnlyConn) LocalAddr() net.Addr
- func (c *ReadOnlyConn) Read(p []byte) (int, error)
- func (c *ReadOnlyConn) RemoteAddr() net.Addr
- func (c *ReadOnlyConn) SetDeadline(_ time.Time) error
- func (c *ReadOnlyConn) SetReadDeadline(_ time.Time) error
- func (c *ReadOnlyConn) SetWriteDeadline(_ time.Time) error
- func (c *ReadOnlyConn) Write(_ []byte) (int, error)
- type SniffConn
Constants ¶
View Source
const TotpLen = 6
Variables ¶
View Source
var (
SkipVerify = false
)
Functions ¶
func AddTrustedCert ¶
func AesDecrypt ¶
func AesEncrypt ¶
func BuildTotpUri ¶ added in v0.33.12
func ComputeHMAC ¶
ComputeHMAC Get HMAC value
func DecryptBytes ¶
DecryptBytes AES-GCM
func DecryptWithPrivateKey ¶
func EncryptBytes ¶
EncryptBytes AES-GCM
func GenerateTOTPSecret ¶
func GenerateUUID ¶ added in v0.33.12
func GetCert ¶
func GetCert() tls.Certificate
func GetCertCfg ¶ added in v0.33.12
func GetCertFingerprint ¶
func GetCertFingerprint(certificate tls.Certificate) []byte
func GetFakeDomainName ¶ added in v0.33.12
func GetFakeDomainName() string
func GetPublicKeyPEM ¶
func GetRSAPublicKeyPEM ¶ added in v0.33.12
func GetRandomString ¶
GetRandomString 生成指定长度的随机密钥,支持可选传入id
func InitTls ¶
func InitTls(customCert tls.Certificate)
func IsValidTOTPSecret ¶ added in v0.33.12
func PKCS5Padding ¶
PKCS5Padding Completion when the length is insufficient
func PKCS5UnPadding ¶
PKCS5UnPadding Remove excess
func PrintTOTPCode ¶
func PrintTOTPCode(secret string)
func PrintTOTPSecret ¶
func PrintTOTPSecret()
func ReadClientHello ¶
func ValidateTOTPCode ¶
Types ¶
type LoginPayload ¶
type LoginPayload struct {
Nonce string `json:"n"`
Timestamp int64 `json:"t"`
Password string `json:"p"`
}
func ParseLoginPayload ¶
func ParseLoginPayload(base64Cipher string) (*LoginPayload, error)
type ReadOnlyConn ¶
type ReadOnlyConn struct {
// contains filtered or unexported fields
}
func (*ReadOnlyConn) Close ¶
func (c *ReadOnlyConn) Close() error
func (*ReadOnlyConn) LocalAddr ¶
func (c *ReadOnlyConn) LocalAddr() net.Addr
func (*ReadOnlyConn) RemoteAddr ¶
func (c *ReadOnlyConn) RemoteAddr() net.Addr
func (*ReadOnlyConn) SetDeadline ¶
func (c *ReadOnlyConn) SetDeadline(_ time.Time) error
func (*ReadOnlyConn) SetReadDeadline ¶
func (c *ReadOnlyConn) SetReadDeadline(_ time.Time) error
func (*ReadOnlyConn) SetWriteDeadline ¶
func (c *ReadOnlyConn) SetWriteDeadline(_ time.Time) error
Click to show internal directories.
Click to hide internal directories.