server

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDump added in v0.26.0

func ConfigDump(w http.ResponseWriter, r *http.Request)

func DeleteRegisteredAdminHandler added in v0.26.0

func DeleteRegisteredAdminHandler(pattern string)

DeleteRegisteredAdminHandler deletes a registered pattern

func DisableLogger added in v0.26.0

func DisableLogger(w http.ResponseWriter, r *http.Request)

func EnableLogger added in v0.26.0

func EnableLogger(w http.ResponseWriter, r *http.Request)

post data: loggeer path

func GetEnv added in v0.26.0

func GetEnv(w http.ResponseWriter, r *http.Request)

func GetLoggerInfo added in v0.26.0

func GetLoggerInfo(w http.ResponseWriter, r *http.Request)

func GetState added in v0.26.0

func GetState(w http.ResponseWriter, r *http.Request)

returns data pid=xxx&state=xxx

func Help added in v0.26.0

func Help(w http.ResponseWriter, r *http.Request)

func KnownFeatures added in v0.26.0

func KnownFeatures(w http.ResponseWriter, r *http.Request)

func OutputVersion added in v1.0.0

func OutputVersion(w http.ResponseWriter, r *http.Request)

func RegisterAdminHandleFunc

func RegisterAdminHandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

RegisterAdminHandleFunc keeps compatible for old ways

func RegisterAdminHandler added in v0.26.0

func RegisterAdminHandler(pattern string, handler *APIHandler)

RegisterAdminHandler registers a API Handler for amdin api, the Handler can contains auths and failed action.

func SetVersion added in v1.0.0

func SetVersion(v string)

func StatsDump added in v0.26.0

func StatsDump(w http.ResponseWriter, r *http.Request)

func StatsDumpProxyTotal added in v0.26.0

func StatsDumpProxyTotal(w http.ResponseWriter, r *http.Request)

func UpdateLogLevel added in v0.26.0

func UpdateLogLevel(w http.ResponseWriter, r *http.Request)

Types

type APIHandler added in v0.26.0

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

APIHandler is a wrapper of http.Handler, which contains auth options

func NewAPIHandler added in v0.26.0

func NewAPIHandler(handler func(http.ResponseWriter, *http.Request), auths ...*Auth) *APIHandler

func (*APIHandler) ServeHTTP added in v0.26.0

func (h *APIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Auth added in v0.26.0

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

Auth contains two parts: check function and failed function. if check function returns false, the Auth.Check will returns false and call failed function. if failed function is nil, use default instead. default function will write a http forbidden without body

func NewAuth added in v0.26.0

func NewAuth(check func(*http.Request) bool, failed func(http.ResponseWriter)) *Auth

func (Auth) Check added in v0.26.0

func (a Auth) Check(w http.ResponseWriter, r *http.Request) bool

type Config

type Config interface {
	GetAdmin() *v2.Admin
}
{
   "admin":{
	"address":{
	     "socket_address":{
		     "address": "0.0.0.0",
		     "port_value": 8888
	     }
	}
   }
}

type LogLevelData

type LogLevelData struct {
	LogPath  string `json:"log_path"`
	LogLevel string `json:"log_level"`
}

update log level

type Server

type Server struct {
	*http.Server
}

func (*Server) Start

func (s *Server) Start(config Config)

Jump to

Keyboard shortcuts

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