core

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NNRMoe

type NNRMoe struct {
	Token       string
	HttpRequest *resty.Request
}

func New

func New(token string) *NNRMoe

func (*NNRMoe) AddRule

func (nnrMoe *NNRMoe) AddRule(rule *RequestAddRule) (result *ResponseRuleDetail)

func (*NNRMoe) DeleteRule

func (nnrMoe *NNRMoe) DeleteRule(ruleID *RequestRuleRid) (result *ResponseDeleteRule)

func (*NNRMoe) EditRule

func (nnrMoe *NNRMoe) EditRule(editedRule *RequestEditedRule) (result *ResponseRuleDetail)

func (*NNRMoe) GetRule added in v0.0.6

func (nnrMoe *NNRMoe) GetRule(ruleID *RequestRuleRid) (result *ResponseRuleDetail)

func (*NNRMoe) GetServer added in v0.0.6

func (nnrMoe *NNRMoe) GetServer(serverID string) (result *ResponseGetServer)

func (*NNRMoe) Rules

func (nnrMoe *NNRMoe) Rules() (result *ResponseRules)

func (*NNRMoe) Servers

func (nnrMoe *NNRMoe) Servers() (result *ResponseServers)

type RequestAddRule

type RequestAddRule struct {
	Sid string `json:"sid"`
	RuleBase
}

type RequestEditedRule

type RequestEditedRule struct {
	Rid string `json:"rid"`
	RuleBase
}

type RequestRuleRid added in v0.0.6

type RequestRuleRid struct {
	Rid string `json:"rid"`
}

type ResponseBase

type ResponseBase struct {
	Status int32
}

func (*ResponseBase) IsStatusOK

func (rb *ResponseBase) IsStatusOK() bool

type ResponseDeleteRule

type ResponseDeleteRule struct {
	ResponseBase
	Data RequestRuleRid
}

type ResponseGetServer added in v0.0.6

type ResponseGetServer struct {
	ResponseBase
	Data ServerInfo
}

type ResponseRuleDetail added in v0.0.6

type ResponseRuleDetail struct {
	ResponseBase
	Data Rule
}

type ResponseRules

type ResponseRules struct {
	ResponseBase
	Data RuleList
}

type ResponseServers

type ResponseServers struct {
	ResponseBase
	Data ServerList
}

type Rule

type Rule struct {
	RuleBase
	Rid     string `json:"rid"`
	Uid     string `json:"uid"`
	Sid     string `json:"sid"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
	Status  int    `json:"status"`
	Traffic int    `json:"traffic"`
	Data    string `json:"data"`
	Date    int64  `json:"date"`
	Setting struct {
		ProxyProtocol   int           `json:"proxyProtocol"`
		LoadbalanceMode string        `json:"loadbalanceMode"`
		Mix0Rtt         bool          `json:"mix0rtt"`
		Src             interface{}   `json:"src"`
		Cfips           []interface{} `json:"cfips"`
	} `json:"setting"`
}

type RuleBase

type RuleBase struct {
	Remote  string `json:"remote"`
	Rport   int    `json:"rport"`
	Type    string `json:"type"`
	Name    string `json:"name"`
	Setting struct {
		LoadbalanceMode string `json:"loadbalanceMode"`
	} `json:"setting"`
}

type RuleList

type RuleList []Rule

type ServerInfo

type ServerInfo struct {
	Sid    string   `json:"sid"`
	Name   string   `json:"name"`
	Host   string   `json:"host"`
	Min    int      `json:"min"`
	Max    int      `json:"max"`
	Mf     float64  `json:"mf"`
	Level  int      `json:"level"`
	Detail string   `json:"detail"`
	Types  []string `json:"types"`
}

type ServerList

type ServerList []ServerInfo

type TypeRequestBody

type TypeRequestBody interface {
	*RequestAddRule | *RequestRuleRid | *RequestEditedRule | string
}

type TypeResponse

type TypeResponse interface {
	*ResponseServers | *ResponseRuleDetail | *ResponseDeleteRule | *ResponseRules | *ResponseGetServer
	IsStatusOK() bool
}

type URL

type URL string
const (
	URLServers    URL = "https://nnr.moe/api/servers"
	URLRules      URL = "https://nnr.moe/api/rules"
	URLAddRule    URL = "https://nnr.moe/api/rules/add"
	URLDeleteRule URL = "https://nnr.moe/api/rules/del"
	URLEditRule   URL = "https://nnr.moe/api/rules/edit"
	URLGetRule    URL = "https://nnr.moe/api/rules/get"
)

Jump to

Keyboard shortcuts

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