handler

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XForwardedFor = "X-Forwarded-For"
	XRealIP       = "X-Real-IP"
)

Variables

This section is empty.

Functions

func GetHandler

func GetHandler(cfg *configs.Config) *http.ServeMux

GetHandler is a handler merger and a router for mutipl handler

func Ip2long

func Ip2long(ipstr string) uint32

Ip2long 将 IPv4 字符串形式转为 uint32

func IsAdminIp

func IsAdminIp(ip string, cfg *configs.Config) bool

func IsLeaderIp

func IsLeaderIp(ip string, cfg *configs.Config) bool

func RemoteIp

func RemoteIp(req *http.Request) string

RemoteIp 返回远程客户端的 IP,如 192.168.1.1

Types

type PostReport

type PostReport struct {
	VoteId                 string
	Vote                   *pb.Vote
	A, B, C, D, E, F, G, H int
	PercentA, PercentB     float32
	PercentC, PercentD     float32
	PercentE, PercentF     float32
	PercentG, PercentH     float32
	TxtFields              []string
}

Jump to

Keyboard shortcuts

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