完善节点筛选机制

This commit is contained in:
2026-06-12 16:43:09 +08:00
parent 513fe78815
commit 25cacf0bca
7 changed files with 40 additions and 82 deletions

View File

@@ -40,6 +40,10 @@ type channelServer struct {
}
func (s *channelServer) CreateChannels(source netip.Addr, resourceNo string, authWhitelist bool, authPassword bool, count int, edgeFilter *EdgeFilter) ([]*m.Channel, error) {
if edgeFilter == nil {
edgeFilter = &EdgeFilter{}
}
var area *m.Area
if edgeFilter.AreaID != nil {
var err error
@@ -265,8 +269,8 @@ func persistChannelCreate(ctx *channelCreateContext, channels []*m.Channel) erro
BatchNo: ctx.BatchNo,
Count: int32(ctx.Count),
ISP: u.X(ctx.Filter.Isp.String()),
Prov: prov,
City: city,
Prov: u.Ternary(ctx.Filter.AreaID != nil, prov, nil),
City: u.Ternary(ctx.Filter.AreaID != nil, city, nil),
IP: orm.Inet{Addr: ctx.Source},
Time: ctx.Now,
}); err != nil {