config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveYaml

func SaveYaml(def *openapi3.T, name string) error

SaveYaml 保存yaml文件

Types

type Account

type Account struct {
	Id        int64 `xorm:"pk autoincr"`
	RelatedId int64 `xorm:"unique"` //当用于用户自定义账户时,是用户ID,当用于source自定义账户时,是sourceid
	User      string
	Password  string
	Denied    bool //定义的
}

type Crypt

type Crypt struct {
	Key   string `goblet:"key,default_key_for_apinx"`
	Tweak string `goblet:"tweak,1D3E5A7C9B0D2F4H"`
	// contains filtered or unexported fields
}

func (*Crypt) Check

func (c *Crypt) Check() error

type OpenAPI

type OpenAPI struct {
	//常见api定义文件
	Welknown string `goblet:"wellknown,wellknown.yaml"`
	//自己的api定义文件
	Api     string `goblet:"api,api.yaml"`
	Append  bool   `goblet:"append,false"`
	Encrypt bool   `goblet:"encrypt,true"`
}

func (*OpenAPI) LoadDefinition

func (o *OpenAPI) LoadDefinition() (*openapi3.T, error)

func (*OpenAPI) NewDefaultDefinition

func (o *OpenAPI) NewDefaultDefinition() (*openapi3.T, error)

type Service

type Service struct {
	//转发地址
	Forward []string `goblet:"url"`
	Tag     string   `goblet:"tag"`
}

func (*Service) GetServers

func (s *Service) GetServers(def *openapi3.T) []*openapi3.Server

type SourceGwConfig

type SourceGwConfig struct {
	Id                 int64 `xorm:"pk autoincr"`
	SourceId           int64 `xorm:"unique"`
	Cors               []string
	Accounts           []*Account       `xorm:"-"` //另表存储的账户信息
	IPRanges           []*SourceIPRange `xorm:"-"` //另表存储的账户信息
	Emulation          bool             //模拟访问
	Gateway            int              //网关访问
	Source             int              `xorm:"default -1"` //从原地址访问代理(存储服务器变量的序号)
	AuthMode           int              //认证模式
	AuthUser           int              //认证用户的来源
	SmartEncrypt       bool             //开启智能脱敏功能
	AllowGw            bool             //允许网关模拟
	AllowUpdate        bool             //允许网关更新文档
	Path               string           `xorm:"-"`
	HideServers        bool             `xorm:"-"`
	NotAllowUnknownIp  bool             //是否禁止未知IP访问
	TimeRanges         []uint32         //接受1天(每天相同)或7天(每周配置)
	DayRangeForMonth   uint32
	QpsMax             int64
	EmulateWhenQpsOver bool //当Qps超标时,是否启动模拟功能
	AllowEveryOne      bool //当配置为无需认证时,是否允许所有人(包括不知道code的人)访问接口
}

type SourceIPRange

type SourceIPRange struct {
	Id       int64 `xorm:"pk autoincr"`
	SourceId int64
	CIDR     *net.IPNet `xorm:"json"`
	Mark     byte
	Denied   bool //是否为黑名单
}

Jump to

Keyboard shortcuts

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