Documentation ¶
Index ¶
- Variables
- func AESCBCDecrypt(key, iv, cipherText []byte) ([]byte, error)
- func AESCBCEncrypt(key, iv, plainText []byte) ([]byte, error)
- func Base64Decode(src string) ([]byte, error)
- func Base64Encode(src []byte) string
- func DefaultAtoi(s string, defaultValue int) int
- func GetExecutableDirectory() (string, error)
- func GetExecutablePath() (string, error)
- func GetPublicIP(ipType string) (string, error)
- func GetTCPListen(portPath, ip string) (net.Listener, error)
- func MatchIPv4(s string) (string, error)
- func MatchIPv6(s string) (string, error)
- func OpenUrl(url string) error
- func PKCS7Padding(ciphertext []byte, blockSize int) ([]byte, error)
- func PKCS7UnPadding(plantText []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var CustomDnsWithNoProxyHttpTransport http.RoundTripper = &http.Transport{ Proxy: nil, ForceAttemptHTTP2: true, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, Resolver: &net.Resolver{ PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { dnsResolverAddress := validDnsResolverAddress(address) d := net.Dialer{ Timeout: dnsResolverTimeout, } return d.DialContext(ctx, network, dnsResolverAddress) }, }, }).DialContext, }
自定义的Transport,内容继承 DefaultTransport,进行如下修改 1. 禁止使用代理 2. 使用指定的DNS地址进行解析(需要使用go1.19版本以上才行,应为在1.19版本修复了windows 无法使用自定义dns的问题)
Functions ¶
func AESCBCDecrypt ¶
AES CBC 解密
@param key []byte aes密钥,长度 16, 24, or 32 对应 AES-128, AES-192, or AES-256
@param iv []byte CBC 初始化向量,长度 16
@param cipherText []byte 待解密内容
func AESCBCEncrypt ¶
AES CBC 加密
@param key []byte aes密钥,长度 16, 24, or 32 对应 AES-128, AES-192, or AES-256
@param iv []byte CBC 初始化向量,长度 16
@param plainText []byte 待加密内容
func GetTCPListen ¶
通过端口文件获取 listen
@param portPath string 端口文件路径
@param ip string 监听的IP. 本地: 127.0.0.1、[::1] ; 全部: 0.0.0.0 、[::] 、 空字符串 ; 指定IP: 192.168.1.2;
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.