From 7ea70e338aa31e05cb35b6695e491863a84f0924 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 11 Aug 2021 09:36:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E8=AE=BE=E7=BD=AE=E4=B8=AD?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=81=E8=AE=B8=E8=AE=B0=E4=BD=8F=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/systemconfigs/security_config.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/systemconfigs/security_config.go b/pkg/systemconfigs/security_config.go index d8ad08f..0a8bd0a 100644 --- a/pkg/systemconfigs/security_config.go +++ b/pkg/systemconfigs/security_config.go @@ -2,18 +2,19 @@ package systemconfigs import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" -// 安全相关配置 +// SecurityConfig 安全相关配置 type SecurityConfig struct { - Frame string `json:"frame"` // Frame嵌套 - AllowCountryIds []int64 `json:"allowCountryIds"` // 允许的国家/地区 - AllowProvinceIds []int64 `json:"allowProvinceIds"` // 允许的省份 - AllowLocal bool `json:"allowLocal"` // 允许本地+局域网IP访问 - AllowIPs []string `json:"allowIPs"` // 允许访问的IP + Frame string `json:"frame"` // Frame嵌套 + AllowCountryIds []int64 `json:"allowCountryIds"` // 允许的国家/地区 + AllowProvinceIds []int64 `json:"allowProvinceIds"` // 允许的省份 + AllowLocal bool `json:"allowLocal"` // 允许本地+局域网IP访问 + AllowIPs []string `json:"allowIPs"` // 允许访问的IP + AllowRememberLogin bool `json:"allowRememberLogin"` // 是否允许在设备上记住登录 allowIPRanges []*shared.IPRangeConfig } -// 初始化 +// Init 初始化 func (this *SecurityConfig) Init() error { this.allowIPRanges = []*shared.IPRangeConfig{} for _, allowIP := range this.AllowIPs { @@ -26,6 +27,7 @@ func (this *SecurityConfig) Init() error { return nil } +// AllowIPRanges 查询允许的IP区域 func (this *SecurityConfig) AllowIPRanges() []*shared.IPRangeConfig { return this.allowIPRanges }