server

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Copyright (C) 2023 wwhai

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const API_V1_ROOT string = "/api/v1/"

Variables

This section is empty.

Functions

func AddRoute

func AddRoute(f func(c *gin.Context,
	ruleEngine typex.RuleX)) func(*gin.Context)

New api after 0.6.4

func AddRouteV2

func AddRouteV2(f func(*gin.Context, typex.RuleX) (any, error)) func(*gin.Context)

AddRouteV2: Only for cron,It's redundant API, will refactor in feature

func Authorize

func Authorize() gin.HandlerFunc

func ContextUrl

func ContextUrl(path string) string

* * 拼接URL *

func Cros

func Cros() gin.HandlerFunc

func DecreaseRateTime

func DecreaseRateTime()

func InitApi

func InitApi()

func LoadNewestDevice

func LoadNewestDevice(uuid string, ruleEngine typex.RuleX) error

LoadNewestDevice

func LoadNewestInEnd

func LoadNewestInEnd(uuid string, ruleEngine typex.RuleX) error

LoadNewestInEnd

func LoadNewestOutEnd

func LoadNewestOutEnd(uuid string, ruleEngine typex.RuleX) error

LoadNewestOutEnd

func RateLimit

func RateLimit() gin.HandlerFunc

func ReInitRateTime

func ReInitRateTime()

func RouteGroup

func RouteGroup(name string) *gin.RouterGroup

new API

func StartDeviceSupervisor

func StartDeviceSupervisor(ctx context.Context, device *typex.Device, ruleEngine typex.RuleX)

* * 设备监控器 5秒检查一下状态 *

func StartInSupervisor

func StartInSupervisor(ctx context.Context, in *typex.InEnd, ruleEngine typex.RuleX)

* * 南向资源监控器 5秒检查一下状态 *

func StartOutSupervisor

func StartOutSupervisor(ctx context.Context, out *typex.OutEnd, ruleEngine typex.RuleX)

* * 北向资源监控器 5秒检查一下状态 *

func StartRateLimiter

func StartRateLimiter()

func StartRulexApiServer

func StartRulexApiServer(ruleEngine typex.RuleX, port int)

* * 开启Server *

func WWWRoot

func WWWRoot(dir string) static.ServeFileSystem

Types

type RulexApiServer

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

* * API Server *

var DefaultApiServer *RulexApiServer

全局API Server

func (*RulexApiServer) AddRoute

func (s *RulexApiServer) AddRoute(f func(c *gin.Context,
	ruleEngine typex.RuleX)) func(*gin.Context)

即将废弃

func (*RulexApiServer) GetGroup

func (s *RulexApiServer) GetGroup(name string) *gin.RouterGroup

func (*RulexApiServer) InitializeConfigCtl

func (s *RulexApiServer) InitializeConfigCtl()

* * 初始化配置 *

func (*RulexApiServer) InitializeEEKITData

func (s *RulexApiServer) InitializeEEKITData()

func (*RulexApiServer) InitializeGenericOSData

func (s *RulexApiServer) InitializeGenericOSData()

* * 初始化网络配置,主要针对Linux,而且目前只支持了Ubuntu1804,后期分一个windows版本 *

func (*RulexApiServer) InitializeUnixData

func (s *RulexApiServer) InitializeUnixData()

func (*RulexApiServer) InitializeWindowsData

func (s *RulexApiServer) InitializeWindowsData()

func (*RulexApiServer) Route

func (s *RulexApiServer) Route() *gin.Engine

type WWWFS

type WWWFS struct {
	http.FileSystem
}

func (WWWFS) Exists

func (f WWWFS) Exists(prefix string, filepath string) bool

Jump to

Keyboard shortcuts

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