添加在线调试 api

This commit is contained in:
2025-03-08 10:59:31 +08:00
parent 053041ae34
commit 5786ac9d99
28 changed files with 236 additions and 539 deletions

View File

@@ -3,7 +3,7 @@ package core
import (
"log/slog"
"net"
"proxy-server/server/models"
models2 "proxy-server/server/pkg/models"
"proxy-server/server/pkg/orm"
"time"
@@ -41,12 +41,12 @@ func CheckIp(conn net.Conn) (*AuthContext, error) {
// 查询权限记录
slog.Debug("用户 " + remoteHost + " 请求连接到 " + localPort)
var channels []models.Channel
var channels []models2.Channel
err = orm.DB.
Joins("INNER JOIN public.nodes n ON channels.node_id = n.id AND n.name = ?", localPort).
Joins("INNER JOIN public.users u ON channels.user_id = u.id").
Joins("INNER JOIN public.user_ips ip ON u.id = ip.user_id AND ip.ip_address = ?", remoteHost).
Where(&models.Channel{
Where(&models2.Channel{
AuthIp: true,
}).
Find(&channels).Error
@@ -88,9 +88,9 @@ func CheckPass(conn net.Conn, username, password string) (*AuthContext, error) {
}, nil
// 查询通道配置
var channel models.Channel
var channel models2.Channel
err := orm.DB.
Where(&models.Channel{
Where(&models2.Channel{
Username: username,
AuthPass: true,
}).
@@ -125,7 +125,7 @@ func CheckPass(conn net.Conn, username, password string) (*AuthContext, error) {
var ips int64
err = orm.DB.
Where(&models.UserIp{
Where(&models2.UserIp{
UserId: channel.UserId,
IpAddress: remoteHost,
}).