mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
Merge remote-tracking branch 'origin/dev_new' into dev_new
This commit is contained in:
commit
0cdb02f2f9
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -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
|
||||
|
@ -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**
|
||||
|
||||
## 特点
|
||||
|
||||
* 永久开源且免费。
|
||||
* 支持V2ray,Trojan, 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内核支持
|
||||
- [ ] 完善使用文档
|
||||
- [ ] 尽可能统一日志输出格式
|
||||
|
||||
## 软件安装
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -185,7 +185,9 @@
|
||||
{
|
||||
// xray内核
|
||||
|
||||
"Name": "xray_node1",
|
||||
"Core": "xray",
|
||||
"CoreName": "",
|
||||
"ApiHost": "http://127.0.0.1",
|
||||
"ApiKey": "test",
|
||||
"NodeID": 33,
|
||||
|
Loading…
Reference in New Issue
Block a user