优化代码结构

This commit is contained in:
2025-05-12 15:13:48 +08:00
parent 8bab6291b1
commit 536f36ae02
11 changed files with 45 additions and 182 deletions

View File

@@ -4,7 +4,7 @@ import (
"log/slog"
"net"
"proxy-server/server/fwd/core"
"proxy-server/server/pkg/models"
"proxy-server/server/fwd/repo"
"proxy-server/server/pkg/orm"
"strconv"
"time"
@@ -38,8 +38,8 @@ func CheckIp(conn net.Conn, proto Protocol) (*core.AuthContext, error) {
// 查询权限记录
slog.Debug("用户 " + remoteHost + " 请求连接到 " + _localPort)
var channels []models.Channel
err = orm.DB.Find(&channels, &models.Channel{
var channels []repo.Channel
err = orm.DB.Find(&channels, &repo.Channel{
AuthIp: true,
UserAddr: remoteHost,
NodePort: localPort,
@@ -84,8 +84,8 @@ func CheckPass(conn net.Conn, proto Protocol, username, password string) (*core.
}
// 查询权限记录
var channel models.Channel
err = orm.DB.Take(&channel, &models.Channel{
var channel repo.Channel
err = orm.DB.Take(&channel, &repo.Channel{
AuthPass: true,
Username: username,
NodePort: localPort,