Documentation ¶
Index ¶
- Variables
- func AesDecrypt(encryptedB64UrlEncodingString string, k []byte) ([]byte, error)
- func AesEncrypt(origData, k []byte) (string, error)
- func BcryptCompare(input, hashedPassword string) error
- func BcryptPassword(raw string) string
- func BrowserOpen(url string)
- func CheckBindArg(c *gin.Context, argPtr interface{}) bool
- func CheckLicenseCode(machineSN, licenseCode string, publicBs []byte) (bool, error)
- func DesDecrypt(decrypted string, key []byte) (string, error)
- func DesEncrypt(text string, key []byte) (string, error)
- func GenerateLtsCertKeyPinPair(name string) (err error)
- func GenerateTlsCert() (*tls.Certificate, error)
- func GetHostName() string
- func GetUserName() string
- func GoogleTranslate(text string) (string, error)
- func IsDirectory(path string) (bool, error)
- func JSONCheckAuthErr(c *gin.Context, err error) bool
- func JSONCheckBizErr(c *gin.Context, err error) bool
- func JSONCheckMwErr(c *gin.Context, err error) bool
- func JSONData(c *gin.Context, data interface{})
- func JSONSuccess(c *gin.Context)
- func KeyPairWithPin() ([]byte, []byte, []byte, error)
- func NewDingHook(url, app string, thresholdLevel logrus.Level) *dingHook
- func NewSshClientConfig(sshUser, sshPassword, sshType, sshKey, sshKeyPassword string) (config *ssh.ClientConfig, err error)
- func ParamUint(c *gin.Context, key string) (uint, error)
- func ParseUrlPage(href, div, jekyllDir string) error
- func ParseUrlPageJianshu(href, div, jekyllDir string) error
- func ParseUrlPageLibraGen(href, div, jekyllDir string) error
- func PriDecrypt(src, privateKey []byte) ([]byte, error)
- func PriEncrypt(src, privateKey []byte) ([]byte, error)
- func PubDecrypt(src, publicKey []byte) ([]byte, error)
- func PubEncrypt(src, publicKey []byte) ([]byte, error)
- func QueryInt(c *gin.Context, key string) (int, error)
- func RandString(n int) string
- func RandStringDigit(n int) string
- func RandStringWordC(n int) string
- func RandStringWordL(n int) string
- func RandStringWordU(n int) string
- func RandomString(n int) string
- func RemoveQInLines(lines []string) (res []string)
- func RequestJson(url, method string, reqBody interface{}, headersKv map[string]string) (*http.Response, error)
- func RequestJsonString(url, method string, reqBody string, headersKv map[string]string) (*http.Response, error)
- func ResponseUnmarshal(resp *http.Response, vPtr interface{}) (bs []byte, err error)
- func Sha1String(s string) string
- func SshKeyPairGenerate() (publicKeyString, privateKeyString string, err error)
- func SshRemoteRunCommand(sshClient *ssh.Client, command string) (string, error)
- func SshdAuthByGithub(user string, key ssh.PublicKey) error
- func WriteTtyRecData(fd io.Writer, data []byte)
- func ZeroPadding(ciphertext []byte, blockSize int) []byte
- func ZeroUnPadding(origData []byte) []byte
- type CmdLines
- type HTTPData
- type HTTPError
- type HTTPSuccess
- type JSONSliceString
- type JSONSliceUint
- type Option
- type Pagination
- type RSASecurity
- func (r *RSASecurity) GetPrivatekey() (*rsa.PrivateKey, error)
- func (r *RSASecurity) GetPublickey() (*rsa.PublicKey, error)
- func (r *RSASecurity) PriKeyDECRYPT(input []byte) ([]byte, error)
- func (r *RSASecurity) PriKeyENCTYPT(input []byte) ([]byte, error)
- func (r *RSASecurity) PubKeyDECRYPT(input []byte) ([]byte, error)
- func (r *RSASecurity) PubKeyENCTYPT(input []byte) ([]byte, error)
- func (r *RSASecurity) SetPrivateKey(priStr []byte) (err error)
- func (r *RSASecurity) SetPublicKey(pubStr []byte) (err error)
- type SshConn
- type Zippie
Constants ¶
This section is empty.
Variables ¶
var ( ErrDataToLarge = errors.New("message too long for RSA public key size") ErrDataLen = errors.New("data length error") ErrDataBroken = errors.New("data broken, first byte is not zero") ErrKeyPairDismatch = errors.New("data is not encrypted by the private key") ErrDecryption = errors.New("decryption error") ErrPublicKey = errors.New("get public key error") ErrPrivateKey = errors.New("get private key error") )
var RSA = &RSASecurity{}
Functions ¶
func AesDecrypt ¶
AesDecrypt aes 解密 cryted 加密之后的b64-url-encoding 字符串 key 对称密钥 密钥长度必须 16/24/32 长度 返回 解密之后的string
func BrowserOpen ¶
func BrowserOpen(url string)
func CheckBindArg ¶
CheckBindArg 绑定参数并兼差错误
func CheckLicenseCode ¶
func GenerateTlsCert ¶
func GenerateTlsCert() (*tls.Certificate, error)
生成证书密钥对 返回*tls.Certificate 做gRPC服务器启动时的参数
func GetHostName ¶
func GetHostName() string
func GetUserName ¶
func GetUserName() string
func GoogleTranslate ¶
func IsDirectory ¶
func JSONCheckBizErr ¶
JSONCheckBizErr 检查错误 业务逻辑service错误的时候使用这个
func JSONCheckMwErr ¶
JSONCheckMwErr gin middleware 报错
func KeyPairWithPin ¶
KeyPairWithPin 返回 PEM证书 and PEM-Name 和SKPI(PIN码) 公共证书的指纹
func NewDingHook ¶
func NewSshClientConfig ¶
func NewSshClientConfig(sshUser, sshPassword, sshType, sshKey, sshKeyPassword string) (config *ssh.ClientConfig, err error)
func ParseUrlPage ¶
func ParseUrlPageJianshu ¶
func ParseUrlPageLibraGen ¶
func RandStringDigit ¶
func RandStringWordC ¶
func RandStringWordL ¶
func RandStringWordU ¶
func RandomString ¶
func RemoveQInLines ¶
func RequestJson ¶
func RequestJson(url, method string, reqBody interface{}, headersKv map[string]string) (*http.Response, error)
RequestJson 发送json参数
func RequestJsonString ¶
func RequestJsonString(url, method string, reqBody string, headersKv map[string]string) (*http.Response, error)
RequestJsonString 发送json-string参数
func ResponseUnmarshal ¶
ResponseUnmarshal 解析http response中的json
func Sha1String ¶
func SshKeyPairGenerate ¶
SshKeyPairGenerate https://gist.github.com/devinodaniel/8f9b8a4f31573f428f29ec0e884e6673#file-gistfile1-txt-L29
func SshRemoteRunCommand ¶
func WriteTtyRecData ¶
func ZeroPadding ¶
func ZeroUnPadding ¶
Types ¶
type HTTPData ¶
type HTTPData struct { Code int `json:"code" example:"200"` Data interface{} `json:"data"` }
HTTPData .
type HTTPError ¶
type HTTPError struct { Code int `json:"code" example:"203"` //203-用户认证错误 204-业务代码错误 205-中间件错误 206-参数错误 Msg string `json:"msg" example:"参数错误:..."` }
HTTPError .
type HTTPSuccess ¶
type HTTPSuccess struct { Code int `json:"code" example:"200"` Msg string `json:"msg" example:"ok"` }
HTTPSuccess .
type JSONSliceString ¶
type JSONSliceString []string
JSONSliceString gorm mysql >= 5.7 JSON字段映射的类型
func (*JSONSliceString) Scan ¶
func (m *JSONSliceString) Scan(input interface{}) error
type Pagination ¶
type Pagination struct { Size int `form:"size" json:"size"` //size 每页显示的数量 Page int `form:"page" json:"page"` //page 页码 Total int64 `json:"total" form:"-"` //total 分页的查询总的数量 List interface{} `json:"list" form:"-"` //data 必须是[]interface{}指针 Order string `form:"order" json:"-"` //Order 排序字段 eg1: created_at:desc eg2:id eg3: id:desc,updated_at Fields string `form:"fields" json:"-"` //Fields 导出excel时候选择导出的column字段名数组, 使用英文逗号分隔 CreatedAt []time.Time `form:"created_at[]" json:"created_at"` UpdatedAt []time.Time `form:"updated_at[]" json:"updated_at"` // contains filtered or unexported fields }
Pagination 分页
type RSASecurity ¶
type RSASecurity struct {
// contains filtered or unexported fields
}
func (*RSASecurity) GetPrivatekey ¶
func (r *RSASecurity) GetPrivatekey() (*rsa.PrivateKey, error)
*rsa.PublicKey
func (*RSASecurity) GetPublickey ¶
func (r *RSASecurity) GetPublickey() (*rsa.PublicKey, error)
*rsa.PrivateKey
func (*RSASecurity) PriKeyDECRYPT ¶
func (r *RSASecurity) PriKeyDECRYPT(input []byte) ([]byte, error)
私钥解密
func (*RSASecurity) PriKeyENCTYPT ¶
func (r *RSASecurity) PriKeyENCTYPT(input []byte) ([]byte, error)
私钥加密
func (*RSASecurity) PubKeyDECRYPT ¶
func (r *RSASecurity) PubKeyDECRYPT(input []byte) ([]byte, error)
公钥解密
func (*RSASecurity) PubKeyENCTYPT ¶
func (r *RSASecurity) PubKeyENCTYPT(input []byte) ([]byte, error)
公钥加密
func (*RSASecurity) SetPrivateKey ¶
func (r *RSASecurity) SetPrivateKey(priStr []byte) (err error)
设置私钥
func (*RSASecurity) SetPublicKey ¶
func (r *RSASecurity) SetPublicKey(pubStr []byte) (err error)
设置公钥
type SshConn ¶
type SshConn struct { // calling Write() to write data into ssh server StdinPipe io.WriteCloser // Write() be called to receive data from ssh server ComboOutput *wsBufferWriter Session *ssh.Session }
connect to ssh server using ssh session.
func NewSshConn ¶
setup ssh shell session set Session and StdinPipe here, and the Session.Stdout and Session.Sdterr are also set.
func (*SshConn) ReceiveWsMsg ¶
func (ssConn *SshConn) ReceiveWsMsg(wsConn *websocket.Conn, logBuff *bytes.Buffer, exitCh chan bool)
ReceiveWsMsg receive websocket msg do some handling then write into ssh.session.stdin
func (*SshConn) SendComboOutput ¶
func (*SshConn) SessionWait ¶
Source Files ¶
- aes.go
- bcrypt.go
- browse_open.go
- cmd_remove_q.go
- crypt_des.go
- gin_request.go
- gin_response.go
- github_ssh_key.go
- google_translate.go
- html2md.go
- http_client.go
- j_slice_string.go
- j_slice_uint.go
- logrus_hook_dingding.go
- pagination.go
- random_string.go
- rsa.go
- self_sign_lts_key.go
- ssh.go
- ssh_key_gen.go
- ssh_shell_conn.go
- sshd_key_util.go
- string_random.go
- tty_recorder.go
- zip.go