util

package
v0.0.0-...-b6dbd3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(cryted string, key string) ([]byte, error)

func AesEncrypt

func AesEncrypt(origData []byte, key string) (string, error)

https://tech.mojotv.cn/2019/06/28/golang-crypt#svekr key length must be 16/24/32

func BrowserOpen

func BrowserOpen(url string) error

func DesDecrypt

func DesDecrypt(decrypted string, key []byte) (string, error)

func DesEncrypt

func DesEncrypt(text string, key []byte) (string, error)

func NewDingHook

func NewDingHook(url, app string, thresholdLevel logrus.Level) *dingHook

func NewSshClientConfig

func NewSshClientConfig(sshUser, sshPassword, sshType, sshKey, sshKeyPassword string) (config *ssh.ClientConfig, err error)

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

补码

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

去码

func ParseUrlPage

func ParseUrlPage(href, div, jekyllDir string) error

func ParseUrlPageJianshu

func ParseUrlPageJianshu(href, div, jekyllDir string) error

func ParseUrlPageLibraGen

func ParseUrlPageLibraGen(href, div, jekyllDir string) error

func RandStringDigit

func RandStringDigit(n int) string

func RandStringWordC

func RandStringWordC(n int) string

func RandStringWordL

func RandStringWordL(n int) string

func RandStringWordU

func RandStringWordU(n int) string

func RandomString

func RandomString(n int) string

func SshRemoteRunCommand

func SshRemoteRunCommand(sshClient *ssh.Client, command string) (string, error)

func ZeroPadding

func ZeroPadding(ciphertext []byte, blockSize int) []byte

func ZeroUnPadding

func ZeroUnPadding(origData []byte) []byte

Types

type Option

type Option struct {
	PreFunc func(string) (string, error)
	ImgFunc func(alt, src, dataSrc string) (iAlt, iSrc string, err error)
	BaseUrl string
	Script  bool
	Style   bool
}

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

func NewSshConn(cols, rows int, sshClient *ssh.Client) (*SshConn, error)

setup ssh shell session set Session and StdinPipe here, and the Session.Stdout and Session.Sdterr are also set.

func (*SshConn) Close

func (s *SshConn) Close()

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 (ssConn *SshConn) SendComboOutput(wsConn *websocket.Conn, exitCh chan bool)

func (*SshConn) SessionWait

func (ssConn *SshConn) SessionWait(quitChan chan bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL