models

package
v0.0.0-...-07ef6c8 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Artistic-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXTERNALHOSTADDR = "https://alert.wxjwlsh.com:9000"
	//EXTERNALHOSTADDR = "http://192.168.1.170:8080"
	INTERNALHOSTADDR = "http://sealalert.seal.svc.cluster.local:8080"
)

Variables

View Source
var HttpRequestPool sync.Pool
View Source
var HttpResponsePool sync.Pool

Functions

func ReleaseHttpRequest

func ReleaseHttpRequest(hr *HttpRequest)

func ReleaseHttpResponse

func ReleaseHttpResponse(hr *HttpResponse)

Types

type AlertBody

type AlertBody struct {
	UniqId        string   `json:"uniq_id" faker:"-"`
	Title         string   `json:"title" faker:"username"`
	Content       string   `json:"content" faker:"email"`
	Mobiles       []string `json:"mobiles" faker:"chinesePhones"`
	SendType      string   `json:"send_type" faker:"-"`
	SendChannel   int      `json:"send_channel" faker:"boundary_start=1023, boundary_end=1023"`
	SendSucc      bool     `json:"send_succ" faker:"-"`
	ConstrictTime int      `json:"constrict_time" faker:"boundary_start=30, boundary_end=120"`
}

func (*AlertBody) JsonBody

func (ab *AlertBody) JsonBody() (string, error)

func (*AlertBody) MarkdownContent

func (ab *AlertBody) MarkdownContent()

func (*AlertBody) Normalize

func (ab *AlertBody) Normalize()

标准化一下

func (*AlertBody) PostParam

func (ab *AlertBody) PostParam() (string, error)

func (*AlertBody) Record2File

func (ab *AlertBody) Record2File()

func (*AlertBody) SendSelfExternel

func (ab *AlertBody) SendSelfExternel() (string, error)

func (*AlertBody) SendSelfInternal

func (ab *AlertBody) SendSelfInternal() (string, error)

func (*AlertBody) UrlParam

func (ab *AlertBody) UrlParam() (string, error)

type BodyTransform

type BodyTransform interface {
	JsonBody() (string, error)
	UrlParam() (string, error)
	PostParam() (string, error)
}

func DetermineByApiName

func DetermineByApiName(apiName string) BodyTransform

type HttpRequest

type HttpRequest struct {
	Url              string            `json:"url"`     //
	Method           string            `json:"method"`  //
	Timeout          time.Duration     `json:"timeout"` //
	Params           map[string]string `json:"params"`  //
	Headers          map[string]string `json:"headers"` //
	EnableTrace      bool              `json:"enable_trace"`
	DisableKeepalive bool              `json:"disable_keepalive"` //
	//cert key
	Mtls map[string]string `json:"mtls"` //
}

func AcquireHttpRequest

func AcquireHttpRequest() *HttpRequest

func (*HttpRequest) Reset

func (hr *HttpRequest) Reset()

type HttpResponse

type HttpResponse struct {
	StatusCode      int                 `json:"status_code"`
	ResponseContent []byte              `json:"response_content"`
	ResponseHeader  map[string][]string `json:"response_header"`
	Elapsed         int64               `json:"elapsed"`
	Error           error               `json:"error"`
	Traces          map[string]int64    `json:"traces"`
}

func AcquireHttpResponse

func AcquireHttpResponse() *HttpResponse

func (*HttpResponse) Reset

func (hr *HttpResponse) Reset()

type MonitorResult

type MonitorResult struct {
	StatusCode  int
	IsSucc      bool
	Elapsed     int
	ErrorReason string
}

func (*MonitorResult) DingdingContent

func (mr *MonitorResult) DingdingContent(name string, siteAddress string) string

func (*MonitorResult) String

func (mr *MonitorResult) String(name string, siteAddress string) string

type SingSmSResp

type SingSmSResp struct {
	Status int    `json:"status"`
	MsgId  string `json:"msgId"`
}

type SingleSmsReq

type SingleSmsReq struct {
	UserId      string `json:"userId"`
	Md5Password string `json:"md5password"`
	Content     string `json:"content"`
	Mobile      string `json:"mobile"`
	ExtCode     string `json:"extCode"`
	MsgId       string `json:"msgId"`
	SId         string `json:"sId"`
}

type Version

type Version struct {
}

func (*Version) JsonBody

func (v *Version) JsonBody() (string, error)

func (*Version) PostParam

func (v *Version) PostParam() (string, error)

func (*Version) UrlParam

func (v *Version) UrlParam() (string, error)

Directories

Path Synopsis
v2

Jump to

Keyboard shortcuts

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