lib

package
v0.0.0-...-99127cc Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TermLogger = true

Functions

func BasicResponseHeaders

func BasicResponseHeaders(buffer *bytes.Buffer, httpVer []byte, stCode []byte, bodyLen int)

func ChHttpVerCmp

func ChHttpVerCmp(req []byte, ver []byte) (res bool)

func ChMethodIsApprove

func ChMethodIsApprove(method int, routerMethods []int) (approve bool)

func ChStr3Cmp

func ChStr3Cmp(ua []byte, c0, c1, c2, c3 byte) (res bool)

nginx

func ChStr4Cmp

func ChStr4Cmp(ua []byte, c0, c1, c2, c3, c4 byte) (res bool)

func ChStr7Cmp

func ChStr7Cmp(ua []byte, c0, c1, c2, c3, c4, c5, c6, c7 byte) (res bool)

func ChStrCmp

func ChStrCmp(s1 []byte, s2 []byte) bool

Types

type LogsOut

type LogsOut struct {
	ChainxRunning    bool
	AccessInfoBuffer chan string
}

func NewLogsOut

func NewLogsOut() *LogsOut

func (*LogsOut) AccessInfo

func (to *LogsOut) AccessInfo(stCode []byte, method string, resource []byte, usages int64)

AccessInfo append a new log into output queue

func (*LogsOut) SignalClose

func (to *LogsOut) SignalClose()

SignalClose close program logs output before exit

type Meta

type Meta struct {
	Data   interface{}
	Expire int64
	// contains filtered or unexported fields
}

type Sessions

type Sessions struct {
	DefaultExpire  int64
	ActiveSessions map[string]Meta
	TokenMap       map[string]string
	// contains filtered or unexported fields
}

func NewSessions

func NewSessions(defaultExpire int64) *Sessions

func (*Sessions) GetIdentifierWithToken

func (s *Sessions) GetIdentifierWithToken(token string) (identifier string, err error)

GetIdentifierWithToken <- as you see

func (*Sessions) GetMetaWithIdentifier

func (s *Sessions) GetMetaWithIdentifier(identifier string) (data Meta, err error)

GetMetaWithIdentifier <- as you see

func (*Sessions) GetMetaWithToken

func (s *Sessions) GetMetaWithToken(token string) (data Meta, identifier string, err error)

GetMetaWithToken <- as you see

func (*Sessions) GetTokenWithIdentifier

func (s *Sessions) GetTokenWithIdentifier(identifier string) (token string, err error)

GetTokenWithIdentifier <- as you see

func (*Sessions) GetTokenWithRequest

func (s *Sessions) GetTokenWithRequest(req *include.ChRequest) (data Meta, identifier string, err error)

func (*Sessions) Register

func (s *Sessions) Register(res *include.ChResponse, identifier string, meta interface{}, expires int64) (token string, ok bool)

Register add user information into sessions table

func (*Sessions) TokenAvailable

func (s *Sessions) TokenAvailable(token string) bool

TokenAvailable if token valid and not expired then return true

func (*Sessions) TokenAvailableWithIdentifier

func (s *Sessions) TokenAvailableWithIdentifier(identifier string) bool

TokenAvailableWithIdentifier <- as you see

Jump to

Keyboard shortcuts

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