middleware

package
v0.0.0-...-c6ee93b Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthAdmin

func AuthAdmin() gin.HandlerFunc

func AuthVerify

func AuthVerify() gin.HandlerFunc

func ConsistentHash

func ConsistentHash() gin.HandlerFunc

func Cors

func Cors() gin.HandlerFunc

func IsStart

func IsStart() gin.HandlerFunc

func Transmit

func Transmit(ctx *gin.Context, path string) bool

Types

type Node

type Node struct {
	IP        string
	HashValue uint32
}

Node 哈希环上的每一个节点

type Ring

type Ring struct {
	Nodes    []Node // 真实节点+虚拟节点
	Replicas int    // 虚拟节点数量
}

Ring 哈希环

func NewRing

func NewRing(replicas int) *Ring

func (*Ring) Add

func (ring *Ring) Add(ips []string)

func (*Ring) Delete

func (ring *Ring) Delete(ips []string)

func (*Ring) Get

func (ring *Ring) Get(name string) string

Get 对用户名称做负载均衡

func (*Ring) Len

func (ring *Ring) Len() int

func (*Ring) Less

func (ring *Ring) Less(i, j int) bool

func (*Ring) Swap

func (ring *Ring) Swap(i, j int)

Jump to

Keyboard shortcuts

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