ip

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LIMIT_INNER_STATUS = 581
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IpAclType

type IpAclType string
const (
	ACL_BLACK IpAclType = "black"
	ACL_WHITE IpAclType = "white"
)

type IpRate

type IpRate struct {
	Rate int64      `json:"rate"`
	Unit IpRateUnit `json:"unit"`
}

type IpRateUnit

type IpRateUnit string
const (
	SECOND IpRateUnit = "qps"
	MINUTE IpRateUnit = "qpm"
)

type IpSourceType

type IpSourceType string
const (
	REMOTE_IP       IpSourceType = "remoteIp"
	X_REAL_IP       IpSourceType = "xRealIp"
	X_FORWARDED_FOR IpSourceType = "xForwardFor"
)

type Policy

type Policy struct {
	apipolicy.BasePolicy
}

func (Policy) CreateDefaultConfig

func (policy Policy) CreateDefaultConfig(ctx map[string]interface{}) apipolicy.PolicyDto

func (Policy) ParseConfig

func (policy Policy) ParseConfig(dto apipolicy.PolicyDto, ctx map[string]interface{}) (apipolicy.PolicyConfig, error)

func (Policy) UnmarshalConfig

func (policy Policy) UnmarshalConfig(config []byte) (apipolicy.PolicyDto, error, string)

type PolicyDto

type PolicyDto struct {
	apipolicy.BaseDto
	IpSource         IpSourceType `json:"ipSource"`
	IpAclType        IpAclType    `json:"ipAclType"`
	IpAclList        []string     `json:"ipAclList,omitempty"`
	IpMaxConnections int64        `json:"ipMaxConnections,omitempty"`
	IpRate           *IpRate      `json:"ipRate,omitempty"`
}

func (PolicyDto) IsValidDto

func (dto PolicyDto) IsValidDto() (bool, string)

Jump to

Keyboard shortcuts

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