invite_code

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseByte = []byte{'H', 'V', 'E', '8', 'S', '2', 'D', 'Z', 'X', '9', 'C', '7', 'P',
	'5', 'I', 'K', '3', 'M', 'J', 'U', 'F', 'R', '4', 'W', 'Y', 'L', 'T', 'N', '6', 'B', 'G', 'Q'}

自定义进制(0,1没有加入,容易与o,l混淆),数组顺序可进行调整增加反推难度,A用来补位因此此数组不包含A,共31个字符。

View Source
var CodeLenth = 8

邀请码长度

View Source
var DefaultInviteCodeHandler = NewInviteCodeHandler(BaseByte, CodeLenth, SuffixByte)

默认邀请码生成器

View Source
var SuffixByte byte = 'A'

A补位字符,不能与自定义重复

Functions

This section is empty.

Types

type InviteCodeHandler

type InviteCodeHandler struct {
	BaseByte []byte

	CodeLength int
	SuffixByte byte
	// contains filtered or unexported fields
}

func NewInviteCodeHandler

func NewInviteCodeHandler(baseByte []byte, codeLength int, suffixByte byte) *InviteCodeHandler

func (*InviteCodeHandler) CodeToId

func (c *InviteCodeHandler) CodeToId(code string) int

func (*InviteCodeHandler) IdToCode

func (c *InviteCodeHandler) IdToCode(id int) string

Jump to

Keyboard shortcuts

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