Skip to content

Commit

Permalink
0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
aiastia committed Jun 27, 2024
1 parent 270f478 commit 59b10a6
Show file tree
Hide file tree
Showing 36 changed files with 645 additions and 2,183 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build go
FROM golang:1.22.0-alpine AS builder
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY . .
ENV CGO_ENABLED=0
Expand Down
1 change: 0 additions & 1 deletion README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ This project is just my personal learning and development and maintenance. I do
| [PMPanel](https://github.com/ByteInternetHK/PMPanel) ||||
| [ProxyPanel](https://github.com/ProxyPanel/ProxyPanel) ||||
| [WHMCS (V2RaySocks)](https://v2raysocks.doxtex.com/) ||||
| [BunPanel](https://github.com/pennyMorant/bunpanel-release) ||||

## Software Installation

Expand Down
1 change: 0 additions & 1 deletion README-vi.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Dự án này chỉ là học tập và phát triển và bảo trì cá nhân c
| [PMPanel](https://github.com/ByteInternetHK/PMPanel) ||||
| [ProxyPanel](https://github.com/ProxyPanel/ProxyPanel) ||||
| [WHMCS (V2RaySocks)](https://v2raysocks.doxtex.com/) ||||
| [BunPanel](https://github.com/pennyMorant/bunpanel-release) ||||

## Cài đặt phần mềm

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ A Xray backend framework that can easily support many panels.
| [ProxyPanel](https://github.com/ProxyPanel/ProxyPanel) ||||
| [WHMCS (V2RaySocks)](https://v2raysocks.doxtex.com/) ||||
| [GoV2Panel](https://github.com/pingProMax/gov2panel) ||||
| [BunPanel](https://github.com/pennyMorant/bunpanel-release) ||||

## 软件安装

Expand Down
1 change: 0 additions & 1 deletion README_Fa.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
| [PMPanel](https://github.com/ByteInternetHK/PMPanel) ||||
| [ProxyPanel](https://github.com/ProxyPanel/ProxyPanel) ||||
| [WHMCS (V2RaySocks)](https://v2raysocks.doxtex.com/) ||||
| [BunPanel](https://github.com/pennyMorant/bunpanel-release) ||||

## نصب نرم افزار

Expand Down
60 changes: 19 additions & 41 deletions api/apimodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,25 @@ type NodeStatus struct {
}

type NodeInfo struct {
AcceptProxyProtocol bool
Authority string
NodeType string // Must be V2ray, Trojan, and Shadowsocks
NodeID int
Port uint32
SpeedLimit uint64 // Bps
AlterID uint16
TransportProtocol string
FakeType string
Host string
Path string
EnableTLS bool
EnableSniffing bool
RouteOnly bool
EnableVless bool
VlessFlow string
CypherMethod string
ServerKey string
ServiceName string
Method string
Header json.RawMessage
HttpHeaders map[string]*conf.StringList
Headers map[string]string
NameServerConfig []*conf.NameServerConfig
EnableREALITY bool
REALITYConfig *REALITYConfig
Show bool
EnableTFO bool
Dest string
ProxyProtocolVer uint64
ServerNames []string
PrivateKey string
MinClientVer string
MaxClientVer string
MaxTimeDiff uint64
ShortIds []string
Xver uint64
Flow string
Security string
Key string
RejectUnknownSni bool
NodeType string // Must be V2ray, Trojan, and Shadowsocks
NodeID int
Port uint32
SpeedLimit uint64 // Bps
AlterID uint16
TransportProtocol string
FakeType string
Host string
Path string
EnableTLS bool
EnableVless bool
VlessFlow string
CypherMethod string
ServerKey string
ServiceName string
Header json.RawMessage
NameServerConfig []*conf.NameServerConfig
EnableREALITY bool
REALITYConfig *REALITYConfig
}

type UserInfo struct {
Expand Down
7 changes: 3 additions & 4 deletions api/gov2panel/gov2panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"os"
"regexp"
"strconv"
"strings"
"sync/atomic"
"time"

log "github.com/sirupsen/logrus"

"github.com/bitly/go-simplejson"
"github.com/go-resty/resty/v2"
"github.com/gogf/gf/v2/util/gconv"
Expand Down Expand Up @@ -177,7 +176,7 @@ func (c *APIClient) GetNodeInfo() (nodeInfo *api.NodeInfo, err error) {
c.resp.Store(server)

switch c.NodeType {
case "V2ray", "Vmess", "Vless":
case "V2ray":
nodeInfo, err = c.parseV2rayNodeResponse(server)
case "Trojan":
nodeInfo, err = c.parseTrojanNodeResponse(server)
Expand All @@ -200,7 +199,7 @@ func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error) {
path := "/api/server/user"

switch c.NodeType {
case "V2ray", "Trojan", "Shadowsocks", "Vmess", "Vless":
case "V2ray", "Trojan", "Shadowsocks":
break
default:
return nil, fmt.Errorf("unsupported node type: %s", c.NodeType)
Expand Down
15 changes: 0 additions & 15 deletions api/newV2board/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,6 @@ type v2ray struct {
ServiceName string `json:"serviceName"`
Header *json.RawMessage `json:"header"`
} `json:"networkSettings"`
VlessNetworkSettings struct {
Path string `json:"path"`
Headers *json.RawMessage `json:"headers"`
ServiceName string `json:"serviceName"`
Header *json.RawMessage `json:"header"`
} `json:"network_settings"`
VlessFlow string `json:"flow"`
VlessTlsSettings struct {
ServerPort string `json:"server_port"`
Dest string `json:"dest"`
xVer uint64 `json:"xver"`
Sni string `json:"server_name"`
PrivateKey string `json:"private_key"`
ShortId string `json:"short_id"`
} `json:"tls_settings"`
Tls int `json:"tls"`
}

Expand Down
63 changes: 9 additions & 54 deletions api/newV2board/v2board.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"os"
"regexp"
"strconv"
"strings"
"sync/atomic"
"time"

log "github.com/sirupsen/logrus"

"github.com/bitly/go-simplejson"
"github.com/go-resty/resty/v2"
"github.com/xtls/xray-core/common/net"
Expand Down Expand Up @@ -55,18 +54,10 @@ func New(apiConfig *api.Config) *APIClient {
}
})
client.SetBaseURL(apiConfig.APIHost)

var nodeType string

if apiConfig.NodeType == "V2ray" && apiConfig.EnableVless {
nodeType = "vless"
} else {
nodeType = strings.ToLower(apiConfig.NodeType)
}
// Create Key for each requests
client.SetQueryParams(map[string]string{
"node_id": strconv.Itoa(apiConfig.NodeID),
"node_type": nodeType,
"node_type": strings.ToLower(apiConfig.NodeType),
"token": apiConfig.Key,
})
// Read local rule list
Expand Down Expand Up @@ -184,7 +175,7 @@ func (c *APIClient) GetNodeInfo() (nodeInfo *api.NodeInfo, err error) {
c.resp.Store(server)

switch c.NodeType {
case "V2ray", "Vmess", "Vless":
case "V2ray":
nodeInfo, err = c.parseV2rayNodeResponse(server)
case "Trojan":
nodeInfo, err = c.parseTrojanNodeResponse(server)
Expand All @@ -207,7 +198,7 @@ func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error) {
path := "/api/v1/server/UniProxy/user"

switch c.NodeType {
case "V2ray", "Trojan", "Shadowsocks", "Vmess", "Vless":
case "V2ray", "Trojan", "Shadowsocks":
break
default:
return nil, fmt.Errorf("unsupported node type: %s", c.NodeType)
Expand Down Expand Up @@ -364,37 +355,11 @@ func (c *APIClient) parseSSNodeResponse(s *serverConfig) (*api.NodeInfo, error)
// parseV2rayNodeResponse parse the response for the given nodeInfo format
func (c *APIClient) parseV2rayNodeResponse(s *serverConfig) (*api.NodeInfo, error) {
var (
host string
header json.RawMessage
enableTLS bool
enableREALITY bool
dest string
xVer uint64
host string
header json.RawMessage
enableTLS bool
)

if s.VlessTlsSettings.Dest != "" {
dest = s.VlessTlsSettings.Dest
} else {
dest = s.VlessTlsSettings.Sni
}
if s.VlessTlsSettings.xVer != 0 {
xVer = s.VlessTlsSettings.xVer
} else {
xVer = 0
}

realityConfig := api.REALITYConfig{
Dest: dest + ":" + s.VlessTlsSettings.ServerPort,
ProxyProtocolVer: xVer,
ServerNames: []string{s.VlessTlsSettings.Sni},
PrivateKey: s.VlessTlsSettings.PrivateKey,
ShortIds: []string{s.VlessTlsSettings.ShortId},
}

if c.EnableVless {
s.NetworkSettings = s.VlessNetworkSettings
}

switch s.Network {
case "ws":
if s.NetworkSettings.Headers != nil {
Expand All @@ -415,16 +380,8 @@ func (c *APIClient) parseV2rayNodeResponse(s *serverConfig) (*api.NodeInfo, erro
}
}

switch s.Tls {
case 0:
enableTLS = false
enableREALITY = false
case 1:
enableTLS = true
enableREALITY = false
case 2:
if s.Tls == 1 {
enableTLS = true
enableREALITY = true
}

// Create GeneralNodeInfo
Expand All @@ -438,11 +395,9 @@ func (c *APIClient) parseV2rayNodeResponse(s *serverConfig) (*api.NodeInfo, erro
Path: s.NetworkSettings.Path,
Host: host,
EnableVless: c.EnableVless,
VlessFlow: s.VlessFlow,
VlessFlow: c.VlessFlow,
ServiceName: s.NetworkSettings.ServiceName,
Header: header,
EnableREALITY: enableREALITY,
REALITYConfig: &realityConfig,
NameServerConfig: s.parseDNSConfig(),
}, nil
}
Expand Down
3 changes: 1 addition & 2 deletions api/pmpanel/pmpanel.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import (
"bufio"
"encoding/json"
"fmt"
"log"
"os"
"reflect"
"regexp"
"strconv"
"time"

log "github.com/sirupsen/logrus"

"github.com/go-resty/resty/v2"

"github.com/XrayR-project/XrayR/api"
Expand Down
Loading

0 comments on commit 59b10a6

Please sign in to comment.