server

package
v1.21.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: Zlib Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	AtDefault = AuthType(0)
	AtName    = AuthType(1)  //用户名
	AtPhone   = AuthType(2)  //手机
	AtEmail   = AuthType(3)  //邮箱
	AtWeiXin  = AuthType(4)  //微信(第三方)
	AtWeibo   = AuthType(5)  //微博(第三方)
	AtQq      = AuthType(6)  //QQ (第三方)
	AtWxMini  = AuthType(7)  //微信小程序(第三方)
	ATWxSer   = AuthType(8)  //微信服务号(第三方)
	AtToday   = AuthType(9)  //今日头条(第三方)
	AtBaidu   = AuthType(10) //百度(第三方)
	AtToken   = AuthType(99) //业务TOKEN验证
	AtVisitor = AuthType(100)
	AtInner   = AuthType(101)
	AtEnd     = AuthType(102)
)
View Source
const (
	AsDefault    = AuthStatus(0) //0=未激活 1=正在.. 2=已激活 3=删除
	AsActivating = AuthStatus(1)
	AsActivated  = AuthStatus(2)
	AsDeleted    = AuthStatus(3)
)
View Source
const (
	AmDefault = AuthMethod(0)
	AmPass    = AuthMethod(1) //密码
	AmSms     = AuthMethod(2) //短信
	AmEnd     = AuthMethod(3)
)
View Source
const (
	VtDefault   = ValidatingType(0)
	VtRegSms    = ValidatingType(1) //注册短信
	VtLogSms    = ValidatingType(2) //登录短信
	VtRegInvite = ValidatingType(3) //注册邀请
	VtActEmail  = ValidatingType(4)
	VtEnd       = ValidatingType(255)
)
View Source
const (
	PlatPc     = "pc"
	PlatMac    = "mac"
	PlatIPhone = "iphone"
	PlatIPad   = "ipad"
	PlatAPhone = "aphone"
	PlatAPad   = "apad"
	PlatTv     = "tv"
)
View Source
const (
	GHealthTtl    = 10
	KGRpcProtocol = "grpc"
	KHttpProtocol = "http"
	KTCPProtocol  = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address added in v0.1.2

type Address struct {
	Scheme  string `json:"scheme" yaml:"scheme" xml:"scheme"`
	Host    string `json:"host" yaml:"host" xml:"host"`
	Port    int    `json:"port" yaml:"port" xml:"port"`
	Path    string `json:"path,omitempty" yaml:"path,omitempty" xml:"path,omitempty"`
	Name    string `json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
	Weight  int    `json:"weight,omitempty" yaml:"weight,omitempty" xml:"weight,omitempty"`
	Timeout int    `json:"timeout,omitempty" yaml:"timeout,omitempty" xml:"timeout,omitempty"`
}

func Parse

func Parse(addr string) (Address, error)

func ParseV2 added in v1.2.0

func ParseV2(addr net.Addr, pubIp string) Address

func ParseWithSeparate added in v0.1.2

func ParseWithSeparate(info string) Address

ParseWithSeparate info = name|scheme://host:post|timeout|weight

func (Address) Adjust added in v0.5.44

func (s Address) Adjust() Address

Adjust 如果IP是自己,调整为 127.0.0.1

func (Address) Clone added in v1.2.0

func (s Address) Clone() Address

func (Address) HasDomain added in v0.1.2

func (s Address) HasDomain() bool

HasDomain 简单的域名 .com,.cn

func (Address) HasIP added in v0.1.2

func (s Address) HasIP() bool

func (Address) HasPort added in v0.1.2

func (s Address) HasPort() bool

func (Address) HasScheme added in v1.2.0

func (s Address) HasScheme() bool

func (Address) IsEqual added in v1.2.0

func (s Address) IsEqual(addr Address) bool

func (Address) IsHttp added in v0.1.2

func (s Address) IsHttp() bool

func (Address) IsScheme added in v0.1.2

func (s Address) IsScheme(scheme string) bool

func (Address) IsSelf added in v1.2.0

func (s Address) IsSelf(addr string) bool

IsSelf 服务就是自己

func (Address) IsValid added in v1.8.2

func (s Address) IsValid() bool

func (Address) IsWs added in v0.5.44

func (s Address) IsWs() bool

func (Address) SetHost added in v0.1.2

func (s Address) SetHost(host string)

func (Address) To added in v0.1.2

func (s Address) To() string

To scheme://host:port

type Addresses added in v1.1.9

type Addresses []Address

func (*Addresses) Add added in v1.1.9

func (ay *Addresses) Add(addr string)

Add @param s = host:port

func (Addresses) Array added in v1.1.9

func (ay Addresses) Array() []string

func (Addresses) Len added in v1.1.9

func (ay Addresses) Len() int

func (Addresses) Less added in v1.1.9

func (ay Addresses) Less(i, j int) bool

Less 权重越大,在前面

func (Addresses) Swap added in v1.1.9

func (ay Addresses) Swap(i, j int)

func (Addresses) ToWeight added in v1.1.9

func (ay Addresses) ToWeight()

type AuthMethod

type AuthMethod int8

AuthMethod 认证方法

func (AuthMethod) Int

func (a AuthMethod) Int() int8

type AuthStatus

type AuthStatus int8

AuthStatus 认证状态

func (AuthStatus) Int

func (a AuthStatus) Int() int8

type AuthType

type AuthType int8

AuthType 认证 1=用户名, 2=手机 3=邮箱 4=微信 5=微博 6=QQ 7=小程序

func (AuthType) Int

func (a AuthType) Int() int8

type Domain added in v0.1.2

type Domain struct {
	Domain string `json:"-"`
	Raw    string `json:"domain" yaml:"domain" xml:"domain"`
}

func (Domain) DomainTo added in v0.1.2

func (c Domain) DomainTo() string

type Health added in v1.0.4

type Health struct {
	URL           Address       `json:"url"`
	Method        string        `json:"method"`
	Protocol      string        `json:"protocol"`
	Ttl           bool          `json:"ttl"`
	Interval      time.Duration `json:"interval"` //(second)
	SuccessStatus int           `json:"successStatus"`
}

func ReadHealth added in v1.0.4

func ReadHealth(filename string) (Health, error)

type Server

type Server interface {
	Init() error
	Start() error
	Stop()
}

type ValidatingType

type ValidatingType int32

ValidatingType 验证类型

func (ValidatingType) Int

func (a ValidatingType) Int() int32

Jump to

Keyboard shortcuts

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