Merge remote-tracking branch 'origin/dev_new' into dev_new

This commit is contained in:
Yuzuki616 2023-10-06 13:04:30 +08:00
commit 0cdb02f2f9
7 changed files with 56 additions and 60 deletions

View File

@ -142,11 +142,7 @@ jobs:
run: |
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
cp ${GITHUB_WORKSPACE}/example/dns.json ./build_assets/dns.json
cp ${GITHUB_WORKSPACE}/example/route.json ./build_assets/route.json
cp ${GITHUB_WORKSPACE}/example/custom_outbound.json ./build_assets/custom_outbound.json
cp ${GITHUB_WORKSPACE}/example/custom_inbound.json ./build_assets/custom_inbound.json
cp ${GITHUB_WORKSPACE}/example/config.yml.example ./build_assets/config.json
cp ${GITHUB_WORKSPACE}/example/*.json ./build_assets/
LIST=('geoip geoip geoip' 'domain-list-community dlc geosite')
for i in "${LIST[@]}"
do

View File

@ -5,12 +5,12 @@
A V2board node server based on multi core, modified from XrayR.
一个基于多种内核的V2board节点服务端修改自XrayR支持V2ay,Trojan,Shadowsocks协议。
**注意:1.1.0将更换为V2board1.7.0之后新增的Api原Api将被移除请1.7.0之前的用户使用1.1.0之前的版本。**
**注意: 本项目需要V2board版本 >= 1.7.0**
## 特点
* 永久开源且免费。
* 支持V2rayTrojan Shadowsocks多种协议。
* 支持Vmess/Vless, Trojan Shadowsocks, Hysteria多种协议。
* 支持Vless和XTLS等新特性。
* 支持单实例对接多节点,无需重复启动。
* 支持限制在线IP。
@ -40,10 +40,7 @@ A V2board node server based on multi core, modified from XrayR.
- [ ] 重新实现动态限速
- [ ] 重新实现在线IP同步跨节点在线IP限制
- [x] 集成基本操作Command(Start, Stop, Restart, Status, Uninstall)
- [ ] 完善Hysteria内核支持
- [ ] 完善使用文档
- [ ] 尽可能统一日志输出格式
## 软件安装

View File

@ -2,8 +2,6 @@ package panel
import (
"fmt"
log "github.com/sirupsen/logrus"
"github.com/goccy/go-json"
)
@ -67,6 +65,5 @@ func (c *Client) ReportUserTraffic(userTraffic []UserTraffic) error {
if err != nil {
return err
}
log.Println(r.String())
return nil
}

View File

@ -1,7 +1,6 @@
package sing
import (
"context"
"crypto/rand"
"encoding/base64"
"fmt"
@ -215,8 +214,9 @@ func (b *Box) AddNode(tag string, info *panel.NodeInfo, config *conf.Options) er
if err != nil {
return err
}
in, err := inbound.New(
context.Background(),
b.ctx,
b.router,
b.logFactory.NewLogger(F.ToString("inbound/", c.Type, "[", tag, "]")),
c,

View File

@ -3,14 +3,9 @@ package sing
import (
"context"
"fmt"
"github.com/goccy/go-json"
"io"
"os"
"runtime/debug"
"time"
"github.com/InazumaV/V2bX/conf"
vCore "github.com/InazumaV/V2bX/core"
"github.com/goccy/go-json"
"github.com/inazumav/sing-box/adapter"
"github.com/inazumav/sing-box/inbound"
"github.com/inazumav/sing-box/log"
@ -22,6 +17,10 @@ import (
F "github.com/sagernet/sing/common/format"
"github.com/sagernet/sing/service"
"github.com/sagernet/sing/service/pause"
"io"
"os"
"runtime/debug"
"time"
)
var _ adapter.Service = (*Box)(nil)
@ -32,6 +31,7 @@ type DNSConfig struct {
}
type Box struct {
ctx context.Context
createdAt time.Time
router adapter.Router
inbounds map[string]adapter.Inbound
@ -170,6 +170,7 @@ func New(c *conf.CoreConfig) (vCore.Core, error) {
}
router.SetClashServer(server)
return &Box{
ctx: ctx,
router: router,
inbounds: inMap,
outbounds: outbounds,

View File

@ -164,12 +164,12 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network) (*
if user != nil && len(user.Email) > 0 {
limit, err = limiter.GetLimiter(sessionInbound.Tag)
if err != nil {
newError("Get limit info error: ", err).AtError().WriteToLog()
newError("get limiter ", sessionInbound.Tag, " error: ", err).AtError().WriteToLog()
common.Close(outboundLink.Writer)
common.Close(inboundLink.Writer)
common.Interrupt(outboundLink.Reader)
common.Interrupt(inboundLink.Reader)
return nil, nil, nil, newError("Get limit info error: ", err)
return nil, nil, nil, newError("get limiter ", sessionInbound.Tag, " error: ", err)
}
// Speed Limit and Device Limit
w, reject := limit.CheckLimit(user.Email,
@ -414,49 +414,48 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
}
sessionInbound := session.InboundFromContext(ctx)
if l != nil {
// del connect count
if sessionInbound.User != nil {
if sessionInbound.User != nil {
if l != nil {
// del connect count
if destination.Network == net.Network_TCP {
defer func() {
l.ConnLimiter.DelConnCount(sessionInbound.User.Email, sessionInbound.Source.Address.IP().String())
}()
}
} else {
var err error
l, err = limiter.GetLimiter(sessionInbound.Tag)
if err != nil {
newError("get limiter ", sessionInbound.Tag, " error: ", err).AtWarning().WriteToLog(session.ExportIDToError(ctx))
}
}
} else {
var err error
l, err = limiter.GetLimiter(sessionInbound.Tag)
if err != nil {
newError("get limiter error: ", err).AtError().WriteToLog(session.ExportIDToError(ctx))
common.Close(link.Writer)
common.Interrupt(link.Reader)
return
}
}
var destStr string
if destination.Address.Family().IsDomain() {
destStr = destination.Address.Domain()
} else {
destStr = destination.Address.IP().String()
}
if l.CheckDomainRule(destStr) {
newError(fmt.Sprintf(
"User %s access domain %s reject by rule",
sessionInbound.User.Email,
destStr)).AtWarning().WriteToLog(session.ExportIDToError(ctx))
common.Close(link.Writer)
common.Interrupt(link.Reader)
return
}
if len(protocol) != 0 {
if l.CheckProtocolRule(protocol) {
newError(fmt.Sprintf(
"User %s access protocol %s reject by rule",
sessionInbound.User.Email,
protocol)).AtWarning().WriteToLog(session.ExportIDToError(ctx))
common.Close(link.Writer)
common.Interrupt(link.Reader)
return
if l != nil {
var destStr string
if destination.Address.Family().IsDomain() {
destStr = destination.Address.Domain()
} else {
destStr = destination.Address.IP().String()
}
if l.CheckDomainRule(destStr) {
newError(fmt.Sprintf(
"User %s access domain %s reject by rule",
sessionInbound.User.Email,
destStr)).AtWarning().WriteToLog(session.ExportIDToError(ctx))
common.Close(link.Writer)
common.Interrupt(link.Reader)
return
}
if len(protocol) != 0 {
if l.CheckProtocolRule(protocol) {
newError(fmt.Sprintf(
"User %s access protocol %s reject by rule",
sessionInbound.User.Email,
protocol)).AtWarning().WriteToLog(session.ExportIDToError(ctx))
common.Close(link.Writer)
common.Interrupt(link.Reader)
return
}
}
}
}
@ -492,6 +491,10 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
}
}
if handler == nil {
handler = d.ohm.GetHandler(inTag)
}
if handler == nil {
handler = d.ohm.GetDefaultHandler()
}

View File

@ -185,7 +185,9 @@
{
// xray
"Name": "xray_node1",
"Core": "xray",
"CoreName": "",
"ApiHost": "http://127.0.0.1",
"ApiKey": "test",
"NodeID": 33,