report

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiStat

type ApiStat struct {
	// AccessCount all the api access count
	AccessCount uint64 `json:"access_count"`
	// VisitorStat the statistical data of visitors
	VisitorStat map[string]uint64 `json:"visitor_stat"`
}

ApiStat the statistical data of api access info

type ConnStat

type ConnStat struct {
	// Addr the client connection address
	Addr string `json:"addr"`
	// IsAuth whether the client is authorized
	IsAuth bool `json:"is_auth"`
	// UserName the username of client
	UserName string `json:"username"`
	// Perm the permission of client
	Perm string `json:"perm"`
	// ConnectTime the connected time of client
	ConnectTime timeutil.Time `json:"connect_time"`
	// AuthTime the authorized time of client
	AuthTime timeutil.Time `json:"auth_time"`
	// DisconnectTime the disconnected time of client
	DisconnectTime timeutil.Time `json:"disconnect_time"`
	// LifeTime the lifetime of a client, it is 0s always that if the client is online
	LifeTime core.Duration `json:"life_time"`
}

ConnStat the client connection info

type EventStat

type EventStat map[string]uint64

EventStat the statistical data of file change events

type Report

type Report struct {
	// Pid returns the process id of the caller
	Pid int `json:"pid"`
	// PPid returns the process id of the caller's parent
	PPid int `json:"ppid"`
	// GOOS is the running program's operating system target
	GOOS string `json:"go_os"`
	// GOARCH is the running program's architecture target
	GOARCH string `json:"go_arch"`
	// GOVersion returns the Go tree's version string
	GOVersion string `json:"go_version"`
	// Version returns the version info of the gofs
	Version string `json:"version"`
	// Online returns the client connection info that is online
	Online map[string]*ConnStat `json:"online"`
	// Offline returns the client connection info that is offline
	Offline []*ConnStat `json:"offline"`
	// Events returns some latest file change events
	Events *toplist.TopList `json:"events"`
	// EventStat returns the statistical data of file change events
	EventStat EventStat `json:"event_stat"`
	// ApiStat returns the statistical data of api access info
	ApiStat ApiStat `json:"api_stat"`
}

Report the program report data

type Reporter

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

Reporter collect the report data

var (
	// GlobalReporter the global reporter
	GlobalReporter *Reporter
)

func (*Reporter) DeleteConnection

func (r *Reporter) DeleteConnection(addr string)

DeleteConnection delete a closed connection

func (*Reporter) Enable

func (r *Reporter) Enable(enabled bool)

Enable enable or disable the Reporter

func (*Reporter) GetReport

func (r *Reporter) GetReport() Report

GetReport get current report data

func (*Reporter) PutApiStat

func (r *Reporter) PutApiStat(ip string)

PutApiStat put an access log of api

func (*Reporter) PutAuth

func (r *Reporter) PutAuth(addr string, user *auth.HashUser)

PutAuth put an auth info to update connection status

func (*Reporter) PutConnection

func (r *Reporter) PutConnection(addr string)

PutConnection put a new connection

func (*Reporter) PutEvent

func (r *Reporter) PutEvent(event eventlog.Event)

PutEvent put a file change event

Jump to

Keyboard shortcuts

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