fix: update RealIP field
This commit is contained in:
parent
8badf6f62b
commit
aeba6b1004
@ -7,7 +7,7 @@ type Config struct {
|
|||||||
Sql Sql `toml:"sql"`
|
Sql Sql `toml:"sql"`
|
||||||
Debug bool `toml:"debug" comment:"输出每条执行的 sql 语句"`
|
Debug bool `toml:"debug" comment:"输出每条执行的 sql 语句"`
|
||||||
Cache Cache `toml:"cache"`
|
Cache Cache `toml:"cache"`
|
||||||
RaelIP bool `toml:"raelIP" comment:"位于反向代理后启用,用于记录真实 ip\n若直接提供服务,请勿打开,否则会被伪造 ip"`
|
RealIP bool `toml:"realIP" comment:"位于反向代理后启用,用于记录真实 ip\n若直接提供服务,请勿打开,否则会被伪造 ip"`
|
||||||
MaxIpUser int `toml:"maxIpUser" comment:"ip 段最大注册用户,ipv4 为 /24 ipv6 为 /48"`
|
MaxIpUser int `toml:"maxIpUser" comment:"ip 段最大注册用户,ipv4 为 /24 ipv6 为 /48"`
|
||||||
RsaPriKey string `toml:"rsaPriKey,multiline" comment:"运行后勿修改,若为集群需设置为一致"`
|
RsaPriKey string `toml:"rsaPriKey,multiline" comment:"运行后勿修改,若为集群需设置为一致"`
|
||||||
TexturePath string `toml:"texturePath" comment:"材质文件保存路径,如果需要对象存储可以把对象储存挂载到本地目录上"`
|
TexturePath string `toml:"texturePath" comment:"材质文件保存路径,如果需要对象存储可以把对象储存挂载到本地目录上"`
|
||||||
@ -76,7 +76,7 @@ func Default() Config {
|
|||||||
Addr: "",
|
Addr: "",
|
||||||
Password: "",
|
Password: "",
|
||||||
},
|
},
|
||||||
RaelIP: false,
|
RealIP: false,
|
||||||
MaxIpUser: 0,
|
MaxIpUser: 0,
|
||||||
RsaPriKey: "",
|
RsaPriKey: "",
|
||||||
TexturePath: "",
|
TexturePath: "",
|
||||||
|
@ -19,7 +19,7 @@ func NewRoute(handelY *yggdrasil.Yggdrasil, handel *handle.Handel, c config.Conf
|
|||||||
userHandel *handle.UserHandel, adminHandel *handle.AdminHandel) http.Handler {
|
userHandel *handle.UserHandel, adminHandel *handle.AdminHandel) http.Handler {
|
||||||
r := chi.NewRouter()
|
r := chi.NewRouter()
|
||||||
r.Use(middleware.RequestID)
|
r.Use(middleware.RequestID)
|
||||||
if c.RaelIP {
|
if c.RealIP {
|
||||||
r.Use(middleware.RealIP)
|
r.Use(middleware.RealIP)
|
||||||
}
|
}
|
||||||
if sl.Enabled(context.Background(), slog.LevelDebug) {
|
if sl.Enabled(context.Background(), slog.LevelDebug) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user