Skip to content

Commit ab07426

Browse files
committed
update
1 parent 8af2d7e commit ab07426

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5219
-300
lines changed

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- published
66
env:
77
REGISTRY: ghcr.io
8-
IMAGE_NAME: xrayr-project/xrayr
8+
IMAGE_NAME: XrayR-project/XrayR
99

1010
jobs:
1111
build:

api/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ package api
66
// API is the interface for different panel's api.
77
type API interface {
88
GetNodeInfo() (nodeInfo *NodeInfo, err error)
9+
// GetXrayRCertConfig returns optional panel-provided certificate config
10+
// (e.g., ACME/lego DNS provider and env vars). Implementations may return nil
11+
// when unsupported.
12+
GetXrayRCertConfig() (certConfig *XrayRCertConfig, err error)
913
GetUserList() (userList *[]UserInfo, err error)
1014
ReportNodeStatus(nodeStatus *NodeStatus) (err error)
1115
ReportNodeOnlineUsers(onlineUser *[]OnlineUser) (err error)

api/apimodel.go

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ const (
1414
)
1515

1616
// Config API config
17+
//
18+
// Note: VLESS-related behavior should primarily follow panel custom_config and
19+
// NodeType definitions to avoid divergence between local settings and panel data.
1720
type Config struct {
1821
APIHost string `mapstructure:"ApiHost"`
1922
NodeID int `mapstructure:"NodeID"`
@@ -39,7 +42,7 @@ type NodeStatus struct {
3942
type NodeInfo struct {
4043
AcceptProxyProtocol bool
4144
Authority string
42-
NodeType string // Must be V2ray, Trojan, and Shadowsocks
45+
NodeType string // Must be V2ray, Trojan, Shadowsocks, VLESS, Hysteria2, AnyTLS, Tuic
4346
NodeID int
4447
Port uint32
4548
SpeedLimit uint64 // Bps
@@ -48,6 +51,7 @@ type NodeInfo struct {
4851
FakeType string
4952
Host string
5053
Path string
54+
SNI string
5155
EnableTLS bool
5256
EnableSniffing bool
5357
RouteOnly bool
@@ -78,6 +82,9 @@ type NodeInfo struct {
7882
Security string
7983
Key string
8084
RejectUnknownSni bool
85+
Hysteria2Config *Hysteria2Config
86+
AnyTLSConfig *AnyTLSConfig
87+
TuicConfig *TuicConfig
8188
}
8289

8390
type UserInfo struct {
@@ -119,6 +126,7 @@ type DetectRule struct {
119126
type DetectResult struct {
120127
UID int
121128
RuleID int
129+
IP string
122130
}
123131

124132
type REALITYConfig struct {
@@ -131,3 +139,36 @@ type REALITYConfig struct {
131139
MaxTimeDiff uint64
132140
ShortIds []string
133141
}
142+
143+
// XrayRCertConfig describes certificate-related options sourced from the panel.
144+
// Useful for provider-specific ACME/lego flows (e.g., Cloudflare DNS envs).
145+
type XrayRCertConfig struct {
146+
Provider string `json:"provider"`
147+
Email string `json:"email"`
148+
DNSEnv map[string]string `json:"dns_env"`
149+
}
150+
151+
// Hysteria2Config holds optional Hysteria2-specific settings.
152+
type Hysteria2Config struct {
153+
Obfs string
154+
ObfsPassword string
155+
UpMbps int
156+
DownMbps int
157+
IgnoreClientBandwidth bool
158+
PortHopEnabled bool
159+
PortHopPorts string
160+
}
161+
162+
// AnyTLSConfig holds AnyTLS-specific tuning options.
163+
type AnyTLSConfig struct {
164+
PaddingScheme []string
165+
}
166+
167+
// TuicConfig holds TUIC-specific settings.
168+
type TuicConfig struct {
169+
CongestionControl string
170+
UDPRelayMode string
171+
ZeroRTTHandshake bool
172+
Heartbeat int
173+
ALPN []string
174+
}

api/bunpanel/bunpanel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/XrayR-project/XrayR/api/bunpanel"
88
)
99

10-
func CreateClient() api.API {
10+
func CreateClient() *bunpanel.APIClient {
1111
apiConfig := &api.Config{
1212
APIHost: "http://localhost:8080",
1313
Key: "123456",

api/bunpanel/model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ type Response struct {
6969

7070
type PostData struct {
7171
Data interface{} `json:"data"`
72-
}
72+
}

api/gov2panel/gov2panel.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func New(apiConfig *api.Config) *APIClient {
5454
RuleListPath: apiConfig.RuleListPath,
5555
DisableCustomConfig: apiConfig.DisableCustomConfig,
5656

57-
LocalRuleList: readLocalRuleList(apiConfig.RuleListPath), //加载本地路由规则
57+
LocalRuleList: readLocalRuleList(apiConfig.RuleListPath), // load local route rules
5858
}
5959
return apiClient
6060
}
@@ -280,7 +280,7 @@ func (c *APIClient) Debug() {
280280

281281
}
282282

283-
// request 统一请求接口
283+
// request helper
284284
func (c *APIClient) sendRequest(headerM map[string]string, method string, url string, data g.Map) (reslutJson *gjson.Json, err error) {
285285
url = c.APIHost + url
286286

@@ -289,11 +289,11 @@ func (c *APIClient) sendRequest(headerM map[string]string, method string, url st
289289
var gResponse *gclient.Response
290290

291291
if c.Timeout > 0 {
292-
client.SetTimeout(time.Duration(c.Timeout) * time.Second) //方法用于设置当前请求超时时间
292+
client.SetTimeout(time.Duration(c.Timeout) * time.Second) // set per-request timeout
293293
} else {
294294
client.SetTimeout(5 * time.Second)
295295
}
296-
client.Retry(3, 10*time.Second) //方法用于设置请求失败时重连次数和重连间隔。
296+
client.Retry(3, 10*time.Second) // retry up to 3 times with backoff
297297

298298
client.SetHeaderMap(headerM)
299299
client.SetHeader("Content-Type", "application/json")

api/gov2panel/gov2panel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/gogf/gf/v2/util/gconv"
1010
)
1111

12-
func CreateClient() api.API {
12+
func CreateClient() *gov2panel.APIClient {
1313
apiConfig := &api.Config{
1414
APIHost: "http://localhost:8080",
1515
Key: "123456",

api/newV2board/v2board_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/XrayR-project/XrayR/api/newV2board"
88
)
99

10-
func CreateClient() api.API {
10+
func CreateClient() *newV2board.APIClient {
1111
apiConfig := &api.Config{
1212
APIHost: "http://localhost:9897",
1313
Key: "qwertyuiopasdfghjkl",

api/pmpanel/pmpanel_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/XrayR-project/XrayR/api/pmpanel"
99
)
1010

11-
func CreateClient() api.API {
11+
func CreateClient() *pmpanel.APIClient {
1212
apiConfig := &api.Config{
1313
APIHost: "http://webapi.yyds.me",
1414
Key: "123456",
@@ -150,8 +150,8 @@ func TestReportIllegal(t *testing.T) {
150150
client := CreateClient()
151151

152152
detectResult := []api.DetectResult{
153-
{1, 2},
154-
{1, 3},
153+
{UID: 1, RuleID: 2},
154+
{UID: 1, RuleID: 3},
155155
}
156156
client.Debug()
157157
err := client.ReportIllegal(&detectResult)

api/proxypanel/proypanel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/XrayR-project/XrayR/api/proxypanel"
99
)
1010

11-
func CreateClient() api.API {
11+
func CreateClient() *proxypanel.APIClient {
1212
apiConfig := &api.Config{
1313
APIHost: "http://127.0.0.1:8888",
1414
Key: "naBDpLvREiwY9qPr",

0 commit comments

Comments
 (0)