fix: update RealIP field

This commit is contained in:
thehrz 2025-04-12 17:18:22 +08:00
parent 8badf6f62b
commit aeba6b1004
Signed by: thehrz
GPG Key ID: C84CBCE7D5F88855
2 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ type Config struct {
Sql Sql `toml:"sql"`
Debug bool `toml:"debug" comment:"输出每条执行的 sql 语句"`
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"`
RsaPriKey string `toml:"rsaPriKey,multiline" comment:"运行后勿修改,若为集群需设置为一致"`
TexturePath string `toml:"texturePath" comment:"材质文件保存路径,如果需要对象存储可以把对象储存挂载到本地目录上"`
@ -76,7 +76,7 @@ func Default() Config {
Addr: "",
Password: "",
},
RaelIP: false,
RealIP: false,
MaxIpUser: 0,
RsaPriKey: "",
TexturePath: "",

View File

@ -19,7 +19,7 @@ func NewRoute(handelY *yggdrasil.Yggdrasil, handel *handle.Handel, c config.Conf
userHandel *handle.UserHandel, adminHandel *handle.AdminHandel) http.Handler {
r := chi.NewRouter()
r.Use(middleware.RequestID)
if c.RaelIP {
if c.RealIP {
r.Use(middleware.RealIP)
}
if sl.Enabled(context.Background(), slog.LevelDebug) {