Реализован production-hardening по fix1: env/reconfigure, IPv4-only, TLS, secrets, firewall, docs

This commit is contained in:
2026-04-26 07:27:06 +05:00
parent 2b4a45ad23
commit 3fccd5c442
109 changed files with 1773 additions and 569 deletions
-1
View File
@@ -28,4 +28,3 @@ type AccountExport struct {
ConAt int64 `json:"conAt"`
Remark string `json:"remark"`
}
-1
View File
@@ -203,4 +203,3 @@ type serverConfigMasquerade struct {
ListenHTTPS *string `yaml:"listenHTTPS,omitempty" json:"listenHTTPS" validate:"omitempty"`
ForceHTTPS *bool `yaml:"forceHTTPS,omitempty" json:"forceHTTPS" validate:"omitempty"`
}
-1
View File
@@ -4,4 +4,3 @@ type Hysteria2UserTraffic struct {
Tx int64 `json:"tx"` // upload
Rx int64 `json:"rx"` // download
}
-1
View File
@@ -25,4 +25,3 @@ type ClashConfig struct {
Proxies []interface{} `yaml:"proxies"`
ProxyGroups []ProxyGroup `yaml:"proxy-groups"`
}
-1
View File
@@ -6,4 +6,3 @@ const (
V2rayN = "v2rayn"
NekoBox = "nekobox"
)
-1
View File
@@ -7,4 +7,3 @@ const (
CodeForbiddenError int = 50403
CodeInvalidError int = 50001
)
+13 -13
View File
@@ -1,17 +1,17 @@
package constant
const (
HUIWebPort = "H_UI_WEB_PORT"
HUIWebContext = "H_UI_WEB_CONTEXT"
HUICrtPath = "H_UI_CRT_PATH"
HUIKeyPath = "H_UI_KEY_PATH"
JwtSecret = "JWT_SECRET"
Hysteria2Enable = "HYSTERIA2_ENABLE"
Hysteria2Config = "HYSTERIA2_CONFIG"
Hysteria2TrafficTime = "HYSTERIA2_TRAFFIC_TIME"
Hysteria2ConfigRemark = "HYSTERIA2_CONFIG_REMARK"
Hysteria2ConfigPortHopping = "HYSTERIA2_CONFIG_PORT_HOPPING"
ResetTrafficCron = "RESET_TRAFFIC_CRON"
ClashExtension = "CLASH_EXTENSION"
HUIWebPort = "H_UI_WEB_PORT"
HUIWebContext = "H_UI_WEB_CONTEXT"
HUICrtPath = "H_UI_CRT_PATH"
HUIKeyPath = "H_UI_KEY_PATH"
JwtSecret = "JWT_SECRET"
Hysteria2TrafficStatsSecret = "HYSTERIA2_TRAFFIC_STATS_SECRET"
Hysteria2Enable = "HYSTERIA2_ENABLE"
Hysteria2Config = "HYSTERIA2_CONFIG"
Hysteria2TrafficTime = "HYSTERIA2_TRAFFIC_TIME"
Hysteria2ConfigRemark = "HYSTERIA2_CONFIG_REMARK"
Hysteria2ConfigPortHopping = "HYSTERIA2_CONFIG_PORT_HOPPING"
ResetTrafficCron = "RESET_TRAFFIC_CRON"
ClashExtension = "CLASH_EXTENSION"
)
-1
View File
@@ -12,4 +12,3 @@ const (
WrongPassword string = "wrong password"
ConfigNotExist string = "config not exist"
)
-1
View File
@@ -18,4 +18,3 @@ const (
Version = "v0.0.22"
)
-1
View File
@@ -34,4 +34,3 @@ type AccountUpdateDto struct {
Deleted *int64 `json:"deleted" form:"deleted" validate:"omitempty,oneof=0 1"`
Remark *string `json:"remark" form:"remark" validate:"omitempty,min=0,max=32"`
}
-1
View File
@@ -16,4 +16,3 @@ type ConfigUpdateDto struct {
type ConfigsUpdateDto struct {
ConfigUpdateDtos []ConfigUpdateDto `json:"configUpdateDtos" form:"configUpdateDtos" validate:"required"`
}
-1
View File
@@ -10,4 +10,3 @@ type BaseDto struct {
type IdDto struct {
Id *int64 `json:"id" form:"id" validate:"required,gt=0"` // Первичный ключ
}
-1
View File
@@ -25,4 +25,3 @@ type Hysteria2UrlDto struct {
AccountId *int64 `json:"accountId" form:"accountId" validate:"required,gt=0"`
Hostname *string `json:"hostname" form:"hostname" validate:"required,min=1,max=255"`
}
-1
View File
@@ -7,4 +7,3 @@ type LogDto struct {
type LogExportDto struct {
Option *int `json:"option" form:"option" validate:"required,oneof=0 1"`
}
-1
View File
@@ -3,4 +3,3 @@ package dto
type ServerDto struct {
Port *int64 `json:"port" form:"port" validate:"required,min=1,max=65535"`
}
+4 -4
View File
@@ -14,8 +14,8 @@ type Account struct {
Deleted *int64 `gorm:"column:deleted;default:0" json:"deleted"`
BaseEntity `gorm:"embedded"`
LoginAt *int64 `gorm:"column:login_at;default:0" json:"loginAt"`
ConAt *int64 `gorm:"column:con_at;default:0" json:"conAt"`
Remark *string `gorm:"column:remark;default:''" json:"remark"`
LoginAt *int64 `gorm:"column:login_at;default:0" json:"loginAt"`
ConAt *int64 `gorm:"column:con_at;default:0" json:"conAt"`
Remark *string `gorm:"column:remark;default:''" json:"remark"`
ForcePasswordChange *int64 `gorm:"column:force_password_change;default:0" json:"forcePasswordChange"`
}
-1
View File
@@ -6,4 +6,3 @@ type Config struct {
Remark *string `gorm:"column:remark;default:''" json:"remark"`
BaseEntity `gorm:"embedded"`
}
-1
View File
@@ -7,4 +7,3 @@ type BaseEntity struct {
CreateTime *time.Time `gorm:"column:create_time;default:null" json:"createTime"`
UpdateTime *time.Time `gorm:"column:update_time;default:null" json:"updateTime"`
}
-1
View File
@@ -29,4 +29,3 @@ type AccountInfoVo struct {
Username string `json:"username"`
Roles []string `json:"roles"`
}
-1
View File
@@ -5,4 +5,3 @@ type ConfigVo struct {
Value string `json:"value"`
Remark string `json:"remark"`
}
-1
View File
@@ -38,4 +38,3 @@ type Hysteria2AcmePathVo struct {
CrtPath string `json:"crtPath"`
KeyPath string `json:"keyPath"`
}
+3 -3
View File
@@ -1,7 +1,7 @@
package vo
type JwtVo struct {
TokenType string `json:"tokenType"`
AccessToken string `json:"accessToken"`
TokenType string `json:"tokenType"`
AccessToken string `json:"accessToken"`
ForcePasswordChange bool `json:"forcePasswordChange"`
}
-1
View File
@@ -21,4 +21,3 @@ type LogHysteria2Vo struct {
Msg string `json:"msg"`
Time string `json:"time"`
}
-1
View File
@@ -13,4 +13,3 @@ type Hysteria2MonitorVo struct {
Version string `json:"version"` // Версия
Running bool `json:"running"` // Статус выполнения
}
-1
View File
@@ -44,4 +44,3 @@ func Fail(message string, c *gin.Context) {
Data: nil,
})
}
-1
View File
@@ -6,4 +6,3 @@ type BaseVo struct {
Id int64 `json:"id"`
CreateTime time.Time `json:"createTime"`
}