util

package
v0.0.0-...-9c2a5be Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UUI31223NotSendingHostHeader      = false
	UUI51288AllowFixedLengthResponses = false
	UUI51292EnableResponseTimeouts    = false
)

Variables

View Source
var LOG = logging.MustGetLogger("crank4go-core")

Functions

func ExitProgram

func ExitProgram(exitFunc func())

ExitProgram a helper function to execute some hooks before exiting the program. usage: 1. wrapper all things that you want to do in a func for example `exitFunc ()` 2. call `ExitProgram(ExitFunc)` inside a `init` func of your program

func GetFreePort

func GetFreePort() (int, error)

func IsNotLocalEnv

func IsNotLocalEnv() bool

Types

type CancelErr

type CancelErr struct {
	Msg string
}

func (CancelErr) Error

func (c CancelErr) Error() string

type ConnectionMonitor

type ConnectionMonitor struct {
	// contains filtered or unexported fields
}

func NewConnectionMonitor

func NewConnectionMonitor(handlers []DataPublishHandler) *ConnectionMonitor

func (*ConnectionMonitor) AvailableConns

func (m *ConnectionMonitor) AvailableConns() int

func (*ConnectionMonitor) ConnectionCount

func (m *ConnectionMonitor) ConnectionCount() int

func (*ConnectionMonitor) OnConnectionAvailable

func (m *ConnectionMonitor) OnConnectionAvailable()

func (*ConnectionMonitor) OnConnectionConsumed

func (m *ConnectionMonitor) OnConnectionConsumed()

OnConnectionConsumed called by connector

func (*ConnectionMonitor) OnConnectionEnded

func (m *ConnectionMonitor) OnConnectionEnded()

OnConnectionEnded called by connector socket

func (*ConnectionMonitor) OnConnectionEnded2

func (m *ConnectionMonitor) OnConnectionEnded2(path, routerSocketID string)

func (*ConnectionMonitor) OnConnectionEnded3

func (m *ConnectionMonitor) OnConnectionEnded3(routerSocketID, path, reqComponentName string, respStatus int, reqDuration, reqBytes, respBytes int64)

OnConnectionEnded3 called by router socket

func (*ConnectionMonitor) OnConnectionStarted

func (m *ConnectionMonitor) OnConnectionStarted()

func (*ConnectionMonitor) OnConnectionStarted2

func (m *ConnectionMonitor) OnConnectionStarted2(path, routerSocketID string)

func (*ConnectionMonitor) OpenFiles

func (m *ConnectionMonitor) OpenFiles() int

func (*ConnectionMonitor) ReportWebsocketPoolSize

func (m *ConnectionMonitor) ReportWebsocketPoolSize(size int)

type CrankerErr

type CrankerErr struct {
	Msg  string
	Code int
}

func (*CrankerErr) ErrCode

func (c *CrankerErr) ErrCode() int

func (*CrankerErr) Error

func (c *CrankerErr) Error() string

type DataPublishHandler

type DataPublishHandler interface {
	PublishData(key string, value int)
}

type DataPublishHandlerFunc

type DataPublishHandlerFunc func(key string, value int)

func (DataPublishHandlerFunc) PublishData

func (f DataPublishHandlerFunc) PublishData(key string, value int)

type HttpClientPolicyErr

type HttpClientPolicyErr struct {
	Msg string
}

HttpClientPolicyErr An error is returned if caused by client policy (such as CheckRedirect), or failure to speak HTTP (such as a network connectivity problem). A non-2xx status code doesn't cause an error.

func (HttpClientPolicyErr) Error

func (pe HttpClientPolicyErr) Error() string

type NoRouteErr

type NoRouteErr struct {
	Msg string
}

func (NoRouteErr) Error

func (err NoRouteErr) Error() string

type Password

type Password string

Password is just an example type implementing the Redactor interface. Any time this is logged, the Redacted() function will be called.

func (Password) Redacted

func (p Password) Redacted() interface{}

type TimeoutErr

type TimeoutErr struct {
	Msg string
}

func (TimeoutErr) Error

func (err TimeoutErr) Error() string

Jump to

Keyboard shortcuts

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