Files
shater/xrayctl/Makefile
T
omarandClaude Opus 4.8 ad272af260
build / aarch64_cortex-a53 (push) Successful in 3m31s
build / x86_64 (push) Has been cancelled
feat(nodes): WireGuard / AmneziaWG outbound via wireguard:// scheme [T2]
Nodes are URI-only, so WireGuard is a new share-link scheme handled in
ParseShareLink — the generator, fingerprint, probe, chain, group and egress
paths all keep working unchanged (no model.go/generate.go control-flow edits).

- sharelink.go: wireguard://|wg:// dispatch → parseWireguard (emits xray
  "wireguard" outbound; no streamSettings so withMark owns the loop-guard mark).
- wireguard.go (new): wgConfig, parseWGConf (wg-quick/AmneziaWG INI), wgConfigToURI,
  wgAWGSupported flag (default off — mainline xray 25.1.30 lacks AWG obfuscation),
  helpers splitCSV/atoiOr/splitEndpoint/parseReserved/toAny3.
- sub.go: schemePrefixes adds wireguard/wg; ImportNodes converts a pasted .conf to
  a wireguard:// URI; extractIdentity fingerprints WG by peer endpoint+publicKey.
- main.go: wireguard selftest fixture. nodes.js: URI placeholder/help mentions WG.
- tests: wireguard_test.go (parse/defaults/missing, .conf round-trip, mark,
  fingerprint uniqueness, generate, import).

Verified live on the 512M VM: xray 25.1.30 ACCEPTS the wireguard outbound
(xray -test OK); endpoint 203.0.113.10:51820, sockopt.mark==255. r10.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 15:27:22 +03:00

58 lines
1.8 KiB
Makefile

#
# OpenWrt package Makefile for xrayctl — the xray control-plane daemon.
# Cross-compiled through the OpenWrt SDK against musl (golang-package.mk).
#
# Absolute path to THIS package's directory (robust for src-link feeds), captured
# before any include changes $(MAKEFILE_LIST).
XRAYCTL_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(TOPDIR)/rules.mk
PKG_NAME:=xrayctl
PKG_VERSION:=0.1.0
PKG_RELEASE:=10
PKG_MAINTAINER:=shater
PKG_LICENSE:=MIT
# Build from the source tree shipped alongside this Makefile (no remote tarball).
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
# Go import path == module name (see go.mod: `module xrayctl`).
GO_PKG:=xrayctl
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_FLAGS:=no-mips16
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/xrayctl
SECTION:=net
CATEGORY:=Network
TITLE:=xray control-plane (UCI -> xray JSON + nft + policy-routing)
URL:=https://github.com/shater/xrayctl
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
endef
define Package/xrayctl/description
xrayctl reads the UCI desired-state (/etc/config/xray), renders an xray JSON
config, an nftables tproxy table (inet shater) and policy-routing, then applies
them atomically with commit-confirm/rollback. Subscriptions, multi-hop chains,
balancer+observatory, per-client/domain/geo routing and DNS split.
endef
# Copy the local Go sources into the build dir before compiling.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) $(XRAYCTL_DIR)*.go $(XRAYCTL_DIR)go.mod $(PKG_BUILD_DIR)/
endef
define Package/xrayctl/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/xrayctl $(1)/usr/bin/xrayctl
endef
$(eval $(call GoBinPackage,xrayctl))
$(eval $(call BuildPackage,xrayctl))