srun

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResultCannotFound = errors.New("result cannot found from response")
)

Functions

func Base64

func Base64(s []byte) string

func DoLogin

func DoLogin(clientIP string, c *Conf) error

func LoginStatus

func LoginStatus(c *Conf) (online bool, ip string, e error)

func Md5

func Md5(content string) string

Md5 编码

func Sha1

func Sha1(content string) string

Sha1 编码

func XEncode

func XEncode(content string, key string) []byte

Types

type Api

type Api struct {
	BaseUrl string
	Client  *http.Client
	Header  http.Header
	// contains filtered or unexported fields
}

func (*Api) GetChallenge

func (a *Api) GetChallenge(username, ip string) (map[string]interface{}, error)

func (*Api) GetUserInfo

func (a *Api) GetUserInfo() (map[string]interface{}, error)

func (*Api) Init

func (a *Api) Init(https bool, domain string, client *http.Client)

func (*Api) Login

func (a *Api) Login(
	Username,
	Password,
	AcID,
	Ip,
	Info,
	ChkSum,
	N,
	Type string,
) (map[string]interface{}, error)

type Conf

type Conf struct {
	//调用 API 时直接访问 https URL
	Https bool
	//登录参数,不可缺省
	LoginInfo LoginInfo
	Client    *http.Client
	// contains filtered or unexported fields
}

type LoginForm

type LoginForm struct {
	Domain   string `json:"domain"`
	UserName string `json:"username"`
	//运营商类型
	UserType string `json:"user_type"`
	PassWord string `json:"password"`
}

type LoginInfo

type LoginInfo struct {
	Form *LoginForm
	Meta *LoginMeta
}

type LoginMeta

type LoginMeta struct {
	N    string `json:"n"`
	Type string `json:"type"`
	Acid string `json:"acid"`
	Enc  string `json:"enc"`
}

Jump to

Keyboard shortcuts

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