req

package
v0.0.0-...-2de323a Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const GenUrl = "https://www.csr.sh/generate"
View Source
const (
	UserAgent = "Encryption365-Client/1.2;BaotaPanel-LinuxVersion"
)

Variables

View Source
var ProductIndex = make(map[string]*Product365)

Functions

This section is empty.

Types

type CSR365

type CSR365 struct {
	Country                string `desc:"国家编号(中国请输入CN)"`
	StateOrProvinceName    string `desc:"省或者直辖市"`
	LocalityName           string `desc:"地区"`
	OrganizationName       string `desc:"公司"`
	OrganizationalUnitName string `desc:"部门"`
	//IP证书默认写入: common-name-for-public-ip-address.com
	CommonName string `desc:"域名"`
	KeySize    string `desc:"加密强度:2048,4096"`
	PublicCer  string
	PrivateKey string
}

* C=CN&ST=ShangHai&L=Shanghai&O=Youtudata&OU=com&CN=127.0.0.1&keySize=2048 application/x-www-form-urlencoded

func NewCsr

func NewCsr() *CSR365

func (*CSR365) Generate

func (c *CSR365) Generate() error

type CertInfo365

type CertInfo365 struct {
	CertStatus   string `json:"cert_status"`
	CreatedAt    string `json:"created_at"`
	TrustoceanId int64  `json:"trustocean_id"`
	CsrCode      string `json:"csr_code"`
}

func CertFromJson

func CertFromJson(jsonStr string) (*CertInfo365, error)

type DcvInfo365

type DcvInfo365 struct {
	Domain          string
	Emails          []string
	DnsHost         string
	DnsType         string
	DnsValue        string
	HttpVerifyLink  string
	HttpsVerifyLink string
	FileName        string
	FileContent     string
}

type OrderInfo365

type OrderInfo365 struct {
	Result         string `json:"result"`
	TrustoceanId   int    `json:"trustocean_id"`
	CertStatus     string `json:"cert_status"`
	CertStatusText string
	ProductName    string `json:"product_name"`
	DomainCount    int    `json:"domain_count"`
	CertCode       string `json:"cert_code"`
	CreatedAt      string `json:"created_at"`
	ExpireAt       string `json:"expire_at"`
	Domains        []string
	DcvInfo        map[string]interface{} `json:"dcv_info"`
	DcvInfos       []*DcvInfo365
	DcvIndex       map[string]*DcvInfo365
}

func OrderFromJSON

func OrderFromJSON(jsonStr string) (*OrderInfo365, error)

func (*OrderInfo365) IsOk

func (o *OrderInfo365) IsOk() bool

func (*OrderInfo365) SaveText

func (o *OrderInfo365) SaveText() error

func (*OrderInfo365) ShowDomain

func (o *OrderInfo365) ShowDomain() string

func (*OrderInfo365) String

func (o *OrderInfo365) String() string

type OrderStatus

type OrderStatus map[string]string

func NewOrderStatus

func NewOrderStatus() OrderStatus

func (OrderStatus) Get

func (o OrderStatus) Get(status string) string

type Product365

type Product365 struct {
	Id    string
	Title string
	//使用范围
	UseAge     string
	IsFree     bool
	Level      string
	Period     string
	PeriodText string
	//单一价格
	Fqdn float64
	//宽字价格
	WildCard float64
}

func ProductFromJSon

func ProductFromJSon(jsonStr string) ([]*Product365, error)

func (*Product365) String

func (p *Product365) String() string

type RegisterInfo

type RegisterInfo struct {
	UserName     string `json:"username" desc:"用户名(邮件)"`
	Password     string `json:"password" desc:"密码"`
	AuthCode     string `json:"authcode" desc:"邮件验证码"`
	RealName     string `json:"realName" desc:"真实姓名"`
	IdCardNumber string `json:"idcardNumber" desc:"身份证号"`
	PhoneNumber  string `json:"phoneNumber" desc:"手机号"`
	Country      string `json:"country" desc:"国家代码(CN - 为中国)"`
	CompanyName  string `json:"companyname" desc:"公司名称"`
}

type ReqCertInfo

type ReqCertInfo struct {
	ProductId string
	Period    string
	CsrCode   string
	Domains   string `desc:"IP/域名, 多个请用英文(,)隔开(泛域名填 *.xxx.com)"`
}

type Request365

type Request365 struct {
	BaseURL string
	Client  http.Client
	Token   *Token365
}

func NewClient

func NewClient() *Request365

func (*Request365) AccountRegister

func (r *Request365) AccountRegister(info *RegisterInfo) (info365 *ResultInfo365, err error)

func (*Request365) ClientCreate

func (r *Request365) ClientCreate(userName, Password string) error

func (*Request365) CreateNewCert

func (r *Request365) CreateNewCert(info *ReqCertInfo) (*OrderInfo365, error)

func (*Request365) GetOrderInfo

func (r *Request365) GetOrderInfo(id string) (*OrderInfo365, error)

func (*Request365) GetProducts

func (r *Request365) GetProducts() ([]*Product365, error)

func (*Request365) SendAuthCode

func (r *Request365) SendAuthCode(userName string) (info365 *ResultInfo365, err error)

func (*Request365) SetToken

func (r *Request365) SetToken(clientId, token string)

type ResultInfo365

type ResultInfo365 struct {
	Status  string `json:"result"`
	Message string `json:"message"`
	OrgText string
}

func (*ResultInfo365) IsOK

func (r *ResultInfo365) IsOK() bool

func (*ResultInfo365) String

func (r *ResultInfo365) String() string

type Token365

type Token365 struct {
	ClientId    string `json:"client_id"`
	AccessToken string `json:"access_token"`
}

func NewTokenFromJson

func NewTokenFromJson(jsonStr string) *Token365

func (*Token365) String

func (r *Token365) String() string

type Value

type Value map[string]string

func StructToValue

func StructToValue(r interface{}) Value

Jump to

Keyboard shortcuts

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