fix: typo

This commit is contained in:
Senis 2022-10-27 08:26:23 +08:00
parent 057f4156bf
commit 838c667a87
43 changed files with 351 additions and 260 deletions

View File

@ -1,33 +1,95 @@
{ {
"android-arm64": { "friendlyName": "android-arm64-v8a" }, "android-arm64": {
"darwin-amd64": { "friendlyName": "macos-64" }, "friendlyName": "android-arm64-v8a"
"darwin-arm64": { "friendlyName": "macos-arm64-v8a" }, },
"dragonfly-amd64": { "friendlyName": "dragonfly-64" }, "darwin-amd64": {
"freebsd-386": { "friendlyName": "freebsd-32" }, "friendlyName": "macos-64"
"freebsd-amd64": { "friendlyName": "freebsd-64" }, },
"freebsd-arm64": { "friendlyName": "freebsd-arm64-v8a" }, "darwin-arm64": {
"freebsd-arm7": { "friendlyName": "freebsd-arm32-v7a" }, "friendlyName": "macos-arm64-v8a"
"linux-386": { "friendlyName": "linux-32" }, },
"linux-amd64": { "friendlyName": "linux-64" }, "dragonfly-amd64": {
"linux-arm5": { "friendlyName": "linux-arm32-v5" }, "friendlyName": "dragonfly-64"
"linux-arm64": { "friendlyName": "linux-arm64-v8a" }, },
"linux-arm6": { "friendlyName": "linux-arm32-v6" }, "freebsd-386": {
"linux-arm7": { "friendlyName": "linux-arm32-v7a" }, "friendlyName": "freebsd-32"
"linux-mips64le": { "friendlyName": "linux-mips64le" }, },
"linux-mips64": { "friendlyName": "linux-mips64" }, "freebsd-amd64": {
"linux-mipslesoftfloat": { "friendlyName": "linux-mips32le-softfloat" }, "friendlyName": "freebsd-64"
"linux-mipsle": { "friendlyName": "linux-mips32le" }, },
"linux-mipssoftfloat": { "friendlyName": "linux-mips32-softfloat" }, "freebsd-arm64": {
"linux-mips": { "friendlyName": "linux-mips32" }, "friendlyName": "freebsd-arm64-v8a"
"linux-ppc64le": { "friendlyName": "linux-ppc64le" }, },
"linux-ppc64": { "friendlyName": "linux-ppc64" }, "freebsd-arm7": {
"linux-riscv64": { "friendlyName": "linux-riscv64" }, "friendlyName": "freebsd-arm32-v7a"
"linux-s390x": { "friendlyName": "linux-s390x" }, },
"openbsd-386": { "friendlyName": "openbsd-32" }, "linux-386": {
"openbsd-amd64": { "friendlyName": "openbsd-64" }, "friendlyName": "linux-32"
"openbsd-arm64": { "friendlyName": "openbsd-arm64-v8a" }, },
"openbsd-arm7": { "friendlyName": "openbsd-arm32-v7a" }, "linux-amd64": {
"windows-386": { "friendlyName": "windows-32" }, "friendlyName": "linux-64"
"windows-amd64": { "friendlyName": "windows-64" }, },
"windows-arm7": { "friendlyName": "windows-arm32-v7a" } "linux-arm5": {
"friendlyName": "linux-arm32-v5"
},
"linux-arm64": {
"friendlyName": "linux-arm64-v8a"
},
"linux-arm6": {
"friendlyName": "linux-arm32-v6"
},
"linux-arm7": {
"friendlyName": "linux-arm32-v7a"
},
"linux-mips64le": {
"friendlyName": "linux-mips64le"
},
"linux-mips64": {
"friendlyName": "linux-mips64"
},
"linux-mipslesoftfloat": {
"friendlyName": "linux-mips32le-softfloat"
},
"linux-mipsle": {
"friendlyName": "linux-mips32le"
},
"linux-mipssoftfloat": {
"friendlyName": "linux-mips32-softfloat"
},
"linux-mips": {
"friendlyName": "linux-mips32"
},
"linux-ppc64le": {
"friendlyName": "linux-ppc64le"
},
"linux-ppc64": {
"friendlyName": "linux-ppc64"
},
"linux-riscv64": {
"friendlyName": "linux-riscv64"
},
"linux-s390x": {
"friendlyName": "linux-s390x"
},
"openbsd-386": {
"friendlyName": "openbsd-32"
},
"openbsd-amd64": {
"friendlyName": "openbsd-64"
},
"openbsd-arm64": {
"friendlyName": "openbsd-arm64-v8a"
},
"openbsd-arm7": {
"friendlyName": "openbsd-arm32-v7a"
},
"windows-386": {
"friendlyName": "windows-32"
},
"windows-amd64": {
"friendlyName": "windows-64"
},
"windows-arm7": {
"friendlyName": "windows-arm32-v7a"
} }
}

View File

@ -21,24 +21,20 @@ jobs:
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v2 uses: actions/checkout@v2
- - name: Set up Docker Buildx
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- - name: Log in to the Container registry
name: Log in to the Container registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- - name: Docker meta
name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: ghcr.io/${{ github.repository }} images: ghcr.io/${{ github.repository }}
- - name: Build and push
name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .

View File

@ -11,14 +11,14 @@ on:
- "go.sum" - "go.sum"
- ".github/workflows/*.yml" - ".github/workflows/*.yml"
pull_request: pull_request:
types: [opened, synchronize, reopened] types: [ opened, synchronize, reopened ]
paths: paths:
- "**/*.go" - "**/*.go"
- "go.mod" - "go.mod"
- "go.sum" - "go.sum"
- ".github/workflows/*.yml" - ".github/workflows/*.yml"
release: release:
types: [published] types: [ published ]
jobs: jobs:
@ -26,8 +26,8 @@ jobs:
strategy: strategy:
matrix: matrix:
# Include amd64 on all platforms. # Include amd64 on all platforms.
goos: [windows, freebsd, openbsd, linux, dragonfly, darwin] goos: [ windows, freebsd, openbsd, linux, dragonfly, darwin ]
goarch: [amd64, 386] goarch: [ amd64, 386 ]
exclude: exclude:
# Exclude i386 on darwin and dragonfly. # Exclude i386 on darwin and dragonfly.
- goarch: 386 - goarch: 386

View File

@ -1,4 +1,5 @@
# XrayR # XrayR
[![](https://img.shields.io/badge/TgChat-@XrayR讨论-blue.svg)](https://t.me/XrayR_project) [![](https://img.shields.io/badge/TgChat-@XrayR讨论-blue.svg)](https://t.me/XrayR_project)
[![](https://img.shields.io/badge/Channel-@XrayR通知-blue.svg)](https://t.me/XrayR_channel) [![](https://img.shields.io/badge/Channel-@XrayR通知-blue.svg)](https://t.me/XrayR_channel)
![](https://img.shields.io/github/stars/XrayR-project/XrayR) ![](https://img.shields.io/github/stars/XrayR-project/XrayR)
@ -14,11 +15,13 @@ A Xray backend framework that can easily support many panels.
如果您喜欢本项目可以右上角点个star+watch持续关注本项目的进展。 如果您喜欢本项目可以右上角点个star+watch持续关注本项目的进展。
使用教程:[详细使用教程](https://xrayr-project.github.io/XrayR-doc/) 使用教程:[详细使用教程](https://xrayr-project.github.io/XrayR-doc/)
## 免责声明 ## 免责声明
本项目只是本人个人学习开发并维护,本人不保证任何可用性,也不对使用本软件造成的任何后果负责。 本项目只是本人个人学习开发并维护,本人不保证任何可用性,也不对使用本软件造成的任何后果负责。
## 特点 ## 特点
* 永久开源且免费。 * 永久开源且免费。
* 支持V2rayTrojan Shadowsocks多种协议。 * 支持V2rayTrojan Shadowsocks多种协议。
* 支持Vless和XTLS等新特性。 * 支持Vless和XTLS等新特性。
@ -45,6 +48,7 @@ A Xray backend framework that can easily support many panels.
| 节点端口限速 | √ | √ | √ | | 节点端口限速 | √ | √ | √ |
| 按照用户限速 | √ | √ | √ | | 按照用户限速 | √ | √ | √ |
| 自定义DNS | √ | √ | √ | | 自定义DNS | √ | √ | √ |
## 支持前端 ## 支持前端
| 前端 | v2ray | trojan | shadowsocks | | 前端 | v2ray | trojan | shadowsocks |
@ -56,14 +60,19 @@ A Xray backend framework that can easily support many panels.
| [WHMCS (V2RaySocks)](https://v2raysocks.doxtex.com/) | √ | √ | √ | | [WHMCS (V2RaySocks)](https://v2raysocks.doxtex.com/) | √ | √ | √ |
## 软件安装 ## 软件安装
### 一键安装 ### 一键安装
``` ```
wget -N https://raw.githubusercontent.com/XrayR-project/XrayR-release/master/install.sh && bash install.sh wget -N https://raw.githubusercontent.com/XrayR-project/XrayR-release/master/install.sh && bash install.sh
``` ```
### 使用Docker部署软件 ### 使用Docker部署软件
[Docker部署教程](https://xrayr-project.github.io/XrayR-doc/xrayr-xia-zai-he-an-zhuang/install/docker) [Docker部署教程](https://xrayr-project.github.io/XrayR-doc/xrayr-xia-zai-he-an-zhuang/install/docker)
### 手动安装 ### 手动安装
[手动安装教程](https://xrayr-project.github.io/XrayR-doc/xrayr-xia-zai-he-an-zhuang/install/manual) [手动安装教程](https://xrayr-project.github.io/XrayR-doc/xrayr-xia-zai-he-an-zhuang/install/manual)
## 配置文件及详细使用教程 ## 配置文件及详细使用教程

View File

@ -11,8 +11,9 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/XrayR-project/XrayR/api"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
"github.com/XrayR-project/XrayR/api"
) )
// APIClient create a api client to the panel. // APIClient create a api client to the panel.
@ -76,7 +77,7 @@ func readLocalRuleList(path string) (LocalRuleList []api.DetectRule) {
// open the file // open the file
file, err := os.Open(path) file, err := os.Open(path)
//handle errors while opening // handle errors while opening
if err != nil { if err != nil {
log.Printf("Error when opening file: %s", err) log.Printf("Error when opening file: %s", err)
return LocalRuleList return LocalRuleList
@ -234,7 +235,7 @@ func (c *APIClient) ReportNodeStatus(nodeStatus *api.NodeStatus) (err error) {
return nil return nil
} }
//ReportNodeOnlineUsers reports online user ip // ReportNodeOnlineUsers reports online user ip
func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error { func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error {
var nodeType = "" var nodeType = ""
switch c.NodeType { switch c.NodeType {

View File

@ -107,7 +107,7 @@ func TestReportReportNodeOnlineUsers(t *testing.T) {
IP: fmt.Sprintf("1.1.1.%d", i), IP: fmt.Sprintf("1.1.1.%d", i),
} }
} }
//client.Debug() // client.Debug()
err = client.ReportNodeOnlineUsers(&onlineUserList) err = client.ReportNodeOnlineUsers(&onlineUserList)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
@ -128,7 +128,7 @@ func TestReportReportUserTraffic(t *testing.T) {
Download: 114514, Download: 114514,
} }
} }
//client.Debug() // client.Debug()
err = client.ReportUserTraffic(&generalUserTraffic) err = client.ReportUserTraffic(&generalUserTraffic)
if err != nil { if err != nil {
t.Error(err) t.Error(err)

View File

@ -11,8 +11,9 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/XrayR-project/XrayR/api"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
"github.com/XrayR-project/XrayR/api"
) )
// APIClient create a api client to the panel. // APIClient create a api client to the panel.
@ -72,7 +73,7 @@ func readLocalRuleList(path string) (LocalRuleList []api.DetectRule) {
// open the file // open the file
file, err := os.Open(path) file, err := os.Open(path)
//handle errors while opening // handle errors while opening
if err != nil { if err != nil {
log.Printf("Error when opening file: %s", err) log.Printf("Error when opening file: %s", err)
return LocalRuleList return LocalRuleList
@ -258,7 +259,7 @@ func (c *APIClient) ReportNodeStatus(nodeStatus *api.NodeStatus) (err error) {
return nil return nil
} }
//ReportNodeOnlineUsers reports online user ip // ReportNodeOnlineUsers reports online user ip
func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error { func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error {
var path string var path string

View File

@ -111,7 +111,7 @@ func TestReportReportNodeOnlineUsers(t *testing.T) {
IP: fmt.Sprintf("1.1.1.%d", i), IP: fmt.Sprintf("1.1.1.%d", i),
} }
} }
//client.Debug() // client.Debug()
err = client.ReportNodeOnlineUsers(&onlineUserList) err = client.ReportNodeOnlineUsers(&onlineUserList)
if err != nil { if err != nil {
t.Error(err) t.Error(err)

View File

@ -13,8 +13,9 @@ import (
"sync" "sync"
"time" "time"
"github.com/XrayR-project/XrayR/api"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
"github.com/XrayR-project/XrayR/api"
) )
var ( var (
@ -89,7 +90,7 @@ func readLocalRuleList(path string) (LocalRuleList []api.DetectRule) {
// open the file // open the file
file, err := os.Open(path) file, err := os.Open(path)
//handle errors while opening // handle errors while opening
if err != nil { if err != nil {
log.Printf("Error when opening file: %s", err) log.Printf("Error when opening file: %s", err)
return LocalRuleList return LocalRuleList
@ -257,7 +258,7 @@ func (c *APIClient) ReportNodeStatus(nodeStatus *api.NodeStatus) (err error) {
return nil return nil
} }
//ReportNodeOnlineUsers reports online user ip // ReportNodeOnlineUsers reports online user ip
func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error { func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error {
c.access.Lock() c.access.Lock()
defer c.access.Unlock() defer c.access.Unlock()
@ -380,7 +381,7 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *NodeInfoResponse) (
if nodeInfoResponse.RawServerString == "" { if nodeInfoResponse.RawServerString == "" {
return nil, fmt.Errorf("No server info in response") return nil, fmt.Errorf("No server info in response")
} }
//nodeInfo.RawServerString = strings.ToLower(nodeInfo.RawServerString) // nodeInfo.RawServerString = strings.ToLower(nodeInfo.RawServerString)
serverConf := strings.Split(nodeInfoResponse.RawServerString, ";") serverConf := strings.Split(nodeInfoResponse.RawServerString, ";")
parsedPort, err := strconv.ParseInt(serverConf[1], 10, 32) parsedPort, err := strconv.ParseInt(serverConf[1], 10, 32)

View File

@ -105,7 +105,7 @@ func TestReportReportNodeOnlineUsers(t *testing.T) {
IP: fmt.Sprintf("1.1.1.%d", i), IP: fmt.Sprintf("1.1.1.%d", i),
} }
} }
//client.Debug() // client.Debug()
err = client.ReportNodeOnlineUsers(&onlineUserList) err = client.ReportNodeOnlineUsers(&onlineUserList)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
@ -126,7 +126,7 @@ func TestReportReportUserTraffic(t *testing.T) {
Download: 114514, Download: 114514,
} }
} }
//client.Debug() // client.Debug()
err = client.ReportUserTraffic(&generalUserTraffic) err = client.ReportUserTraffic(&generalUserTraffic)
if err != nil { if err != nil {
t.Error(err) t.Error(err)

View File

@ -12,9 +12,10 @@ import (
"sync" "sync"
"time" "time"
"github.com/XrayR-project/XrayR/api"
"github.com/bitly/go-simplejson" "github.com/bitly/go-simplejson"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
"github.com/XrayR-project/XrayR/api"
) )
// APIClient create an api client to the panel. // APIClient create an api client to the panel.
@ -81,7 +82,7 @@ func readLocalRuleList(path string) (LocalRuleList []api.DetectRule) {
// open the file // open the file
file, err := os.Open(path) file, err := os.Open(path)
//handle errors while opening // handle errors while opening
if err != nil { if err != nil {
log.Printf("Error when opening file: %s", err) log.Printf("Error when opening file: %s", err)
return LocalRuleList return LocalRuleList
@ -294,7 +295,7 @@ func (c *APIClient) ReportNodeStatus(nodeStatus *api.NodeStatus) (err error) {
return nil return nil
} }
//ReportNodeOnlineUsers implements the API interface // ReportNodeOnlineUsers implements the API interface
func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error { func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error {
return nil return nil
} }

View File

@ -82,7 +82,7 @@ func TestReportReportUserTraffic(t *testing.T) {
Download: 114514, Download: 114514,
} }
} }
//client.Debug() // client.Debug()
err = client.ReportUserTraffic(&generalUserTraffic) err = client.ReportUserTraffic(&generalUserTraffic)
if err != nil { if err != nil {
t.Error(err) t.Error(err)

View File

@ -12,9 +12,10 @@ import (
"sync" "sync"
"time" "time"
"github.com/XrayR-project/XrayR/api"
"github.com/bitly/go-simplejson" "github.com/bitly/go-simplejson"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
"github.com/XrayR-project/XrayR/api"
) )
// APIClient create an api client to the panel. // APIClient create an api client to the panel.
@ -80,7 +81,7 @@ func readLocalRuleList(path string) (LocalRuleList []api.DetectRule) {
// open the file // open the file
file, err := os.Open(path) file, err := os.Open(path)
//handle errors while opening // handle errors while opening
if err != nil { if err != nil {
log.Printf("Error when opening file: %s", err) log.Printf("Error when opening file: %s", err)
return LocalRuleList return LocalRuleList
@ -287,7 +288,7 @@ func (c *APIClient) ReportNodeStatus(nodeStatus *api.NodeStatus) (err error) {
return nil return nil
} }
//ReportNodeOnlineUsers implements the API interface // ReportNodeOnlineUsers implements the API interface
func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error { func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) error {
return nil return nil
} }

View File

@ -83,7 +83,7 @@ func TestReportReportUserTraffic(t *testing.T) {
Download: 114514, Download: 114514,
} }
} }
//client.Debug() // client.Debug()
err = client.ReportUserTraffic(&generalUserTraffic) err = client.ReportUserTraffic(&generalUserTraffic)
if err != nil { if err != nil {
t.Error(err) t.Error(err)

View File

@ -9,8 +9,6 @@ import (
"sync" "sync"
"time" "time"
"github.com/XrayR-project/XrayR/common/limiter"
"github.com/XrayR-project/XrayR/common/rule"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/log" "github.com/xtls/xray-core/common/log"
@ -26,6 +24,9 @@ import (
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
"github.com/XrayR-project/XrayR/common/limiter"
"github.com/XrayR-project/XrayR/common/rule"
) )
var errSniffingTimeout = newError("timeout on sniffing") var errSniffingTimeout = newError("timeout on sniffing")

View File

@ -13,11 +13,12 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/XrayR-project/XrayR/common/legocmd/log"
"github.com/go-acme/lego/v4/certcrypto" "github.com/go-acme/lego/v4/certcrypto"
"github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/lego"
"github.com/go-acme/lego/v4/registration" "github.com/go-acme/lego/v4/registration"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/XrayR-project/XrayR/common/legocmd/log"
) )
const ( const (
@ -59,7 +60,6 @@ const (
// │ │ └── CA server ("server" option) // │ │ └── CA server ("server" option)
// │ └── root accounts directory // │ └── root accounts directory
// └── "path" option // └── "path" option
//
type AccountsStorage struct { type AccountsStorage struct {
userID string userID string
rootPath string rootPath string

View File

@ -11,11 +11,12 @@ import (
"strings" "strings"
"time" "time"
"github.com/XrayR-project/XrayR/common/legocmd/log"
"github.com/go-acme/lego/v4/certcrypto" "github.com/go-acme/lego/v4/certcrypto"
"github.com/go-acme/lego/v4/certificate" "github.com/go-acme/lego/v4/certificate"
"github.com/urfave/cli" "github.com/urfave/cli"
"golang.org/x/net/idna" "golang.org/x/net/idna"
"github.com/XrayR-project/XrayR/common/legocmd/log"
) )
const ( const (
@ -36,7 +37,6 @@ const (
// ./.lego/archives/ // ./.lego/archives/
// │ └── archived certificates directory // │ └── archived certificates directory
// └── "path" option // └── "path" option
//
type CertificatesStorage struct { type CertificatesStorage struct {
rootPath string rootPath string
archivePath string archivePath string

View File

@ -1,8 +1,9 @@
package cmd package cmd
import ( import (
"github.com/XrayR-project/XrayR/common/legocmd/log"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/XrayR-project/XrayR/common/legocmd/log"
) )
func Before(ctx *cli.Context) error { func Before(ctx *cli.Context) error {

View File

@ -5,11 +5,12 @@ import (
"crypto/x509" "crypto/x509"
"time" "time"
"github.com/XrayR-project/XrayR/common/legocmd/log"
"github.com/go-acme/lego/v4/certcrypto" "github.com/go-acme/lego/v4/certcrypto"
"github.com/go-acme/lego/v4/certificate" "github.com/go-acme/lego/v4/certificate"
"github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/lego"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/XrayR-project/XrayR/common/legocmd/log"
) )
const ( const (

View File

@ -1,8 +1,9 @@
package cmd package cmd
import ( import (
"github.com/XrayR-project/XrayR/common/legocmd/log"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/XrayR-project/XrayR/common/legocmd/log"
) )
func createRevoke() cli.Command { func createRevoke() cli.Command {

View File

@ -6,11 +6,12 @@ import (
"os" "os"
"strings" "strings"
"github.com/XrayR-project/XrayR/common/legocmd/log"
"github.com/go-acme/lego/v4/certificate" "github.com/go-acme/lego/v4/certificate"
"github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/lego"
"github.com/go-acme/lego/v4/registration" "github.com/go-acme/lego/v4/registration"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/XrayR-project/XrayR/common/legocmd/log"
) )
func createRun() cli.Command { func createRun() cli.Command {

View File

@ -9,11 +9,12 @@ import (
"strings" "strings"
"time" "time"
"github.com/XrayR-project/XrayR/common/legocmd/log"
"github.com/go-acme/lego/v4/certcrypto" "github.com/go-acme/lego/v4/certcrypto"
"github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/lego"
"github.com/go-acme/lego/v4/registration" "github.com/go-acme/lego/v4/registration"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/XrayR-project/XrayR/common/legocmd/log"
) )
const filePerm os.FileMode = 0o600 const filePerm os.FileMode = 0o600

View File

@ -5,7 +5,6 @@ import (
"strings" "strings"
"time" "time"
"github.com/XrayR-project/XrayR/common/legocmd/log"
"github.com/go-acme/lego/v4/challenge" "github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/challenge/http01" "github.com/go-acme/lego/v4/challenge/http01"
@ -15,6 +14,8 @@ import (
"github.com/go-acme/lego/v4/providers/http/memcached" "github.com/go-acme/lego/v4/providers/http/memcached"
"github.com/go-acme/lego/v4/providers/http/webroot" "github.com/go-acme/lego/v4/providers/http/webroot"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/XrayR-project/XrayR/common/legocmd/log"
) )
func setupChallenges(ctx *cli.Context, client *lego.Client) { func setupChallenges(ctx *cli.Context, client *lego.Client) {

View File

@ -11,8 +11,9 @@ import (
"runtime" "runtime"
"strings" "strings"
"github.com/XrayR-project/XrayR/common/legocmd/cmd"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/XrayR-project/XrayR/common/legocmd/cmd"
) )
var version = "dev" var version = "dev"
@ -134,7 +135,7 @@ func (l *LegoCMD) HTTPCert(domain, email string) (CertPath string, KeyPath strin
return CertPath, KeyPath, nil return CertPath, KeyPath, nil
} }
//RenewCert renew a domain cert // RenewCert renew a domain cert
func (l *LegoCMD) RenewCert(domain, email, certMode, provider string, DNSEnv map[string]string) (CertPath string, KeyPath string, err error) { func (l *LegoCMD) RenewCert(domain, email, certMode, provider string, DNSEnv map[string]string) (CertPath string, KeyPath string, err error) {
var argstring string var argstring string
defer func() (string, string, error) { defer func() (string, string, error) {

View File

@ -57,4 +57,3 @@ func Warnf(format string, args ...interface{}) {
func Infof(format string, args ...interface{}) { func Infof(format string, args ...interface{}) {
Printf("[INFO] "+format, args...) Printf("[INFO] "+format, args...)
} }

View File

@ -5,8 +5,9 @@ import (
"fmt" "fmt"
"sync" "sync"
"github.com/XrayR-project/XrayR/api"
"golang.org/x/time/rate" "golang.org/x/time/rate"
"github.com/XrayR-project/XrayR/api"
) )
type UserInfo struct { type UserInfo struct {

View File

@ -1,9 +1,8 @@
package limiter package limiter
import ( import (
"io"
"context" "context"
"io"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/buf"

View File

@ -8,8 +8,9 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/XrayR-project/XrayR/api"
mapset "github.com/deckarep/golang-set" mapset "github.com/deckarep/golang-set"
"github.com/XrayR-project/XrayR/api"
) )
type RuleManager struct { type RuleManager struct {

View File

@ -15,10 +15,12 @@
"tag": "socks5-warp", "tag": "socks5-warp",
"protocol": "socks", "protocol": "socks",
"settings": { "settings": {
"servers": [{ "servers": [
{
"address": "127.0.0.1", "address": "127.0.0.1",
"port": 1080 "port": 1080
}] }
]
} }
}, },
{ {

View File

@ -3,11 +3,12 @@ package all
import ( import (
// The following are necessary as they register handlers in their init functions. // The following are necessary as they register handlers in their init functions.
_ "github.com/xtls/xray-core/app/proxyman/inbound"
_ "github.com/xtls/xray-core/app/proxyman/outbound"
// Required features. Can't remove unless there is replacements. // Required features. Can't remove unless there is replacements.
// _ "github.com/xtls/xray-core/app/dispatcher" // _ "github.com/xtls/xray-core/app/dispatcher"
_ "github.com/XrayR-project/XrayR/app/mydispatcher" _ "github.com/XrayR-project/XrayR/app/mydispatcher"
_ "github.com/xtls/xray-core/app/proxyman/inbound"
_ "github.com/xtls/xray-core/app/proxyman/outbound"
// Default commander and all its services. This is an optional feature. // Default commander and all its services. This is an optional feature.
_ "github.com/xtls/xray-core/app/commander" _ "github.com/xtls/xray-core/app/commander"

View File

@ -12,9 +12,10 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/XrayR-project/XrayR/panel"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/XrayR-project/XrayR/panel"
) )
var ( var (
@ -96,7 +97,7 @@ func main() {
p.Start() p.Start()
defer p.Close() defer p.Close()
//Explicitly triggering GC to remove garbage from config loading. // Explicitly triggering GC to remove garbage from config loading.
runtime.GC() runtime.GC()
// Running backend // Running backend
{ {

View File

@ -8,6 +8,14 @@ import (
"github.com/XrayR-project/XrayR/app/mydispatcher" "github.com/XrayR-project/XrayR/app/mydispatcher"
"github.com/imdario/mergo"
"github.com/r3labs/diff/v2"
"github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/app/stats"
"github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/infra/conf"
"github.com/XrayR-project/XrayR/api" "github.com/XrayR-project/XrayR/api"
"github.com/XrayR-project/XrayR/api/pmpanel" "github.com/XrayR-project/XrayR/api/pmpanel"
"github.com/XrayR-project/XrayR/api/proxypanel" "github.com/XrayR-project/XrayR/api/proxypanel"
@ -17,13 +25,6 @@ import (
_ "github.com/XrayR-project/XrayR/main/distro/all" _ "github.com/XrayR-project/XrayR/main/distro/all"
"github.com/XrayR-project/XrayR/service" "github.com/XrayR-project/XrayR/service"
"github.com/XrayR-project/XrayR/service/controller" "github.com/XrayR-project/XrayR/service/controller"
"github.com/imdario/mergo"
"github.com/r3labs/diff/v2"
"github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/app/stats"
"github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/infra/conf"
) )
// Panel Structure // Panel Structure

View File

@ -4,13 +4,14 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/XrayR-project/XrayR/api"
"github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/inbound" "github.com/xtls/xray-core/features/inbound"
"github.com/xtls/xray-core/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/proxy" "github.com/xtls/xray-core/proxy"
"github.com/XrayR-project/XrayR/api"
) )
func (c *Controller) removeInbound(tag string) error { func (c *Controller) removeInbound(tag string) error {

View File

@ -6,10 +6,6 @@ import (
"reflect" "reflect"
"time" "time"
"github.com/XrayR-project/XrayR/api"
"github.com/XrayR-project/XrayR/app/mydispatcher"
"github.com/XrayR-project/XrayR/common/legocmd"
"github.com/XrayR-project/XrayR/common/serverstatus"
"github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/task" "github.com/xtls/xray-core/common/task"
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
@ -17,6 +13,11 @@ import (
"github.com/xtls/xray-core/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/XrayR-project/XrayR/api"
"github.com/XrayR-project/XrayR/app/mydispatcher"
"github.com/XrayR-project/XrayR/common/legocmd"
"github.com/XrayR-project/XrayR/common/serverstatus"
) )
type LimitInfo struct { type LimitInfo struct {
@ -85,7 +86,7 @@ func (c *Controller) Start() error {
if err != nil { if err != nil {
return err return err
} }
//sync controller userList // sync controller userList
c.userList = userInfo c.userList = userInfo
// Add Limiter // Add Limiter
@ -387,31 +388,31 @@ func (c *Controller) addNewUser(userInfo *[]api.UserInfo, nodeInfo *api.NodeInfo
} }
func compareUserList(old, new *[]api.UserInfo) (deleted, added []api.UserInfo) { func compareUserList(old, new *[]api.UserInfo) (deleted, added []api.UserInfo) {
msrc := make(map[api.UserInfo]byte) //按源数组建索引 msrc := make(map[api.UserInfo]byte) // 按源数组建索引
mall := make(map[api.UserInfo]byte) //源+目所有元素建索引 mall := make(map[api.UserInfo]byte) // 源+目所有元素建索引
var set []api.UserInfo //交集 var set []api.UserInfo // 交集
//1.源数组建立map // 1.源数组建立map
for _, v := range *old { for _, v := range *old {
msrc[v] = 0 msrc[v] = 0
mall[v] = 0 mall[v] = 0
} }
//2.目数组中,存不进去,即重复元素,所有存不进去的集合就是并集 // 2.目数组中,存不进去,即重复元素,所有存不进去的集合就是并集
for _, v := range *new { for _, v := range *new {
l := len(mall) l := len(mall)
mall[v] = 1 mall[v] = 1
if l != len(mall) { //长度变化,即可以存 if l != len(mall) { // 长度变化,即可以存
l = len(mall) l = len(mall)
} else { //存不了,进并集 } else { // 存不了,进并集
set = append(set, v) set = append(set, v)
} }
} }
//3.遍历交集,在并集中找,找到就从并集中删,删完后就是补集(即并-交=所有变化的元素) // 3.遍历交集,在并集中找,找到就从并集中删,删完后就是补集(即并-交=所有变化的元素)
for _, v := range set { for _, v := range set {
delete(mall, v) delete(mall, v)
} }
//4.此时mall是补集所有元素去源中找找到就是删除的找不到的必定能在目数组中找到即新加的 // 4.此时mall是补集所有元素去源中找找到就是删除的找不到的必定能在目数组中找到即新加的
for v := range mall { for v := range mall {
_, exist := msrc[v] _, exist := msrc[v]
if exist { if exist {

View File

@ -8,12 +8,13 @@ import (
"syscall" "syscall"
"testing" "testing"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/infra/conf"
"github.com/XrayR-project/XrayR/api" "github.com/XrayR-project/XrayR/api"
"github.com/XrayR-project/XrayR/api/sspanel" "github.com/XrayR-project/XrayR/api/sspanel"
_ "github.com/XrayR-project/XrayR/main/distro/all" _ "github.com/XrayR-project/XrayR/main/distro/all"
. "github.com/XrayR-project/XrayR/service/controller" . "github.com/XrayR-project/XrayR/service/controller"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/infra/conf"
) )
func TestController(t *testing.T) { func TestController(t *testing.T) {
@ -68,7 +69,7 @@ func TestController(t *testing.T) {
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
//Explicitly triggering GC to remove garbage from config loading. // Explicitly triggering GC to remove garbage from config loading.
runtime.GC() runtime.GC()
{ {

View File

@ -1,19 +1,20 @@
//Package generate the InbounderConfig used by add inbound // Package generate the InbounderConfig used by add inbound
package controller package controller
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/XrayR-project/XrayR/api"
"github.com/XrayR-project/XrayR/common/legocmd"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/uuid" "github.com/xtls/xray-core/common/uuid"
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/infra/conf" "github.com/xtls/xray-core/infra/conf"
"github.com/XrayR-project/XrayR/api"
"github.com/XrayR-project/XrayR/common/legocmd"
) )
//InboundBuilder build Inbound config for different protocol // InboundBuilder build Inbound config for different protocol
func InboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.InboundHandlerConfig, error) { func InboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.InboundHandlerConfig, error) {
inboundDetourConfig := &conf.InboundDetourConfig{} inboundDetourConfig := &conf.InboundDetourConfig{}
// Build Listen IP address // Build Listen IP address

View File

@ -4,13 +4,14 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/XrayR-project/XrayR/api"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/infra/conf" "github.com/xtls/xray-core/infra/conf"
"github.com/XrayR-project/XrayR/api"
) )
//OutboundBuilder build freedom outbund config for addoutbound // OutboundBuilder build freedom outbund config for addoutbound
func OutboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.OutboundHandlerConfig, error) { func OutboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.OutboundHandlerConfig, error) {
outboundDetourConfig := &conf.OutboundDetourConfig{} outboundDetourConfig := &conf.OutboundDetourConfig{}
outboundDetourConfig.Protocol = "freedom" outboundDetourConfig.Protocol = "freedom"

View File

@ -4,13 +4,14 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/XrayR-project/XrayR/api"
"github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/infra/conf" "github.com/xtls/xray-core/infra/conf"
"github.com/xtls/xray-core/proxy/shadowsocks" "github.com/xtls/xray-core/proxy/shadowsocks"
"github.com/xtls/xray-core/proxy/trojan" "github.com/xtls/xray-core/proxy/trojan"
"github.com/xtls/xray-core/proxy/vless" "github.com/xtls/xray-core/proxy/vless"
"github.com/XrayR-project/XrayR/api"
) )
var AEADMethod = []shadowsocks.CipherType{shadowsocks.CipherType_AES_128_GCM, shadowsocks.CipherType_AES_256_GCM, shadowsocks.CipherType_CHACHA20_POLY1305, shadowsocks.CipherType_XCHACHA20_POLY1305} var AEADMethod = []shadowsocks.CipherType{shadowsocks.CipherType_AES_128_GCM, shadowsocks.CipherType_AES_256_GCM, shadowsocks.CipherType_CHACHA20_POLY1305, shadowsocks.CipherType_XCHACHA20_POLY1305}