feat(cli): add settings menu and VLESS log viewer with core selection
- Add settings menu to switch between Xray and V2Ray cores for VLESS connections - Implement core type persistence in configuration with LoadSettings/SaveSettings - Add VLESS error and access log viewer showing last 30 and 20 lines respectively - Display current core type and system time in main menu - Update VLESS connection to use selected core dynamically - Refactor monitor.go to accept 'q' key input for graceful exit instead of signal handling - Add proxy platform-specific implementations (proxy_unix.go, proxy_windows.go) - Add downloader module for managing binary resources - Include V2Ray and Xray configuration files and geodata (geoip.dat, geosite.dat) - Update CLI imports to include path/filepath and time packages - Improve user experience with core selection visibility and log diagnostics
This commit is contained in:
@@ -5,9 +5,11 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"vpn-client/internal/config"
|
||||
"vpn-client/internal/subscription"
|
||||
@@ -69,6 +71,14 @@ func Run() error {
|
||||
fmt.Printf("%s %v\n", red("✗"), err)
|
||||
}
|
||||
pause()
|
||||
} else {
|
||||
// Настройки
|
||||
settingsMenu()
|
||||
}
|
||||
case "7":
|
||||
if isConnected {
|
||||
// Настройки
|
||||
settingsMenu()
|
||||
} else {
|
||||
fmt.Printf("%s Неверный выбор\n", red("✗"))
|
||||
pause()
|
||||
@@ -86,12 +96,25 @@ func Run() error {
|
||||
func showMainMenu() {
|
||||
state, _ := vpn.GetStatus()
|
||||
|
||||
// Получаем актуальный статус с временем
|
||||
statusLine := ShowQuickStatus()
|
||||
|
||||
// Показываем текущее ядро
|
||||
settings, _ := config.LoadSettings()
|
||||
coreName := "Xray"
|
||||
if settings != nil && settings.CoreType == "v2ray" {
|
||||
coreName = "V2Ray"
|
||||
}
|
||||
|
||||
fmt.Println("\n" + strings.Repeat("=", 60))
|
||||
fmt.Println(bold("VPN Клиент (Go)"))
|
||||
fmt.Println(strings.Repeat("=", 60))
|
||||
fmt.Printf("Статус: %s\n", statusLine)
|
||||
fmt.Printf("Ядро VLESS: %s\n", cyan(coreName))
|
||||
|
||||
// Показываем текущее время
|
||||
fmt.Printf("Время: %s\n", time.Now().Format("15:04:05"))
|
||||
|
||||
fmt.Println(strings.Repeat("=", 60))
|
||||
fmt.Println("1. WireGuard")
|
||||
fmt.Println("2. VLESS")
|
||||
@@ -101,8 +124,10 @@ func showMainMenu() {
|
||||
if state != nil && state.Connected {
|
||||
fmt.Println("5. " + green("Мониторинг в реальном времени"))
|
||||
fmt.Println("6. Отключиться от VPN")
|
||||
fmt.Println("7. " + yellow("Настройки (выбор ядра)"))
|
||||
} else {
|
||||
fmt.Println("5. Отключиться от VPN")
|
||||
fmt.Println("6. " + yellow("Настройки (выбор ядра)"))
|
||||
}
|
||||
|
||||
fmt.Println("0. Выход")
|
||||
@@ -120,6 +145,7 @@ func vlessMenu() {
|
||||
fmt.Println("3. Удалить конфиг")
|
||||
fmt.Println("4. Подключиться")
|
||||
fmt.Println("5. Тестировать конфиг (пинг)")
|
||||
fmt.Println("6. " + yellow("Показать логи ошибок"))
|
||||
fmt.Println("0. Назад")
|
||||
fmt.Println(strings.Repeat("=", 50))
|
||||
|
||||
@@ -143,6 +169,9 @@ func vlessMenu() {
|
||||
case "5":
|
||||
testVLESSConfig()
|
||||
pause()
|
||||
case "6":
|
||||
showVLESSLogs()
|
||||
pause()
|
||||
default:
|
||||
fmt.Printf("%s Неверный выбор\n", red("✗"))
|
||||
pause()
|
||||
@@ -270,9 +299,16 @@ func connectVLESS() {
|
||||
|
||||
configName := configs.VLESS[num-1].Name
|
||||
|
||||
fmt.Printf("\nПодключение к '%s' через Xray...\n", configName)
|
||||
// Показываем текущее ядро
|
||||
settings, _ := config.LoadSettings()
|
||||
coreName := "Xray"
|
||||
if settings != nil && settings.CoreType == "v2ray" {
|
||||
coreName = "V2Ray"
|
||||
}
|
||||
|
||||
if err := vless.Connect(configName, config.LogsDir, config.XrayDir); err != nil {
|
||||
fmt.Printf("\nПодключение к '%s' через %s...\n", configName, coreName)
|
||||
|
||||
if err := vless.Connect(configName, config.LogsDir); err != nil {
|
||||
fmt.Printf("%s Ошибка подключения: %v\n", red("✗"), err)
|
||||
return
|
||||
}
|
||||
@@ -904,3 +940,105 @@ func connectWireGuard() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func settingsMenu() {
|
||||
clearScreen()
|
||||
|
||||
settings, err := config.LoadSettings()
|
||||
if err != nil {
|
||||
fmt.Printf("%s Ошибка загрузки настроек: %v\n", red("✗"), err)
|
||||
pause()
|
||||
return
|
||||
}
|
||||
|
||||
currentCore := "Xray"
|
||||
if settings.CoreType == "v2ray" {
|
||||
currentCore = "V2Ray"
|
||||
}
|
||||
|
||||
fmt.Println("\n" + strings.Repeat("=", 60))
|
||||
fmt.Println(bold("Настройки"))
|
||||
fmt.Println(strings.Repeat("=", 60))
|
||||
fmt.Printf("Текущее ядро для VLESS: %s\n", cyan(currentCore))
|
||||
fmt.Println(strings.Repeat("=", 60))
|
||||
fmt.Println("\nВыберите ядро для подключения к VLESS:")
|
||||
fmt.Println("1. Xray (рекомендуется)")
|
||||
fmt.Println("2. V2Ray")
|
||||
fmt.Println("0. Назад")
|
||||
fmt.Println(strings.Repeat("=", 60))
|
||||
|
||||
choice := readInput("\nВыберите действие: ")
|
||||
|
||||
switch choice {
|
||||
case "1":
|
||||
settings.CoreType = "xray"
|
||||
if err := config.SaveSettings(settings); err != nil {
|
||||
fmt.Printf("%s Ошибка сохранения настроек: %v\n", red("✗"), err)
|
||||
} else {
|
||||
fmt.Printf("%s Ядро изменено на Xray\n", green("✓"))
|
||||
}
|
||||
pause()
|
||||
case "2":
|
||||
settings.CoreType = "v2ray"
|
||||
if err := config.SaveSettings(settings); err != nil {
|
||||
fmt.Printf("%s Ошибка сохранения настроек: %v\n", red("✗"), err)
|
||||
} else {
|
||||
fmt.Printf("%s Ядро изменено на V2Ray\n", green("✓"))
|
||||
}
|
||||
pause()
|
||||
case "0":
|
||||
return
|
||||
default:
|
||||
fmt.Printf("%s Неверный выбор\n", red("✗"))
|
||||
pause()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func showVLESSLogs() {
|
||||
fmt.Println("\n" + strings.Repeat("=", 60))
|
||||
fmt.Println(bold("Логи VLESS/Xray/V2Ray"))
|
||||
fmt.Println(strings.Repeat("=", 60))
|
||||
|
||||
errorLog := filepath.Join(config.LogsDir, "vless_error.log")
|
||||
accessLog := filepath.Join(config.LogsDir, "vless_access.log")
|
||||
|
||||
// Показываем лог ошибок
|
||||
fmt.Println("\n" + yellow("=== Лог ошибок (последние 30 строк) ==="))
|
||||
if data, err := os.ReadFile(errorLog); err == nil && len(data) > 0 {
|
||||
lines := strings.Split(string(data), "\n")
|
||||
start := len(lines) - 30
|
||||
if start < 0 {
|
||||
start = 0
|
||||
}
|
||||
for i := start; i < len(lines); i++ {
|
||||
if strings.TrimSpace(lines[i]) != "" {
|
||||
fmt.Println(lines[i])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fmt.Println("Лог пуст или не найден")
|
||||
}
|
||||
|
||||
fmt.Println("\n" + cyan("=== Лог доступа (последние 20 строк) ==="))
|
||||
if data, err := os.ReadFile(accessLog); err == nil && len(data) > 0 {
|
||||
lines := strings.Split(string(data), "\n")
|
||||
start := len(lines) - 20
|
||||
if start < 0 {
|
||||
start = 0
|
||||
}
|
||||
for i := start; i < len(lines); i++ {
|
||||
if strings.TrimSpace(lines[i]) != "" {
|
||||
fmt.Println(lines[i])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fmt.Println("Лог пуст или не найден")
|
||||
}
|
||||
|
||||
fmt.Println("\n" + strings.Repeat("=", 60))
|
||||
fmt.Printf("Полные логи:\n")
|
||||
fmt.Printf(" Ошибки: %s\n", errorLog)
|
||||
fmt.Printf(" Доступ: %s\n", accessLog)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ package cli
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
@@ -25,20 +26,22 @@ func MonitorConnection() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Println("Нажмите Ctrl+C для выхода из мониторинга\n")
|
||||
fmt.Println("Нажмите 'q' или Ctrl+C для выхода из мониторинга\n")
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
// Создаем канал для обработки сигналов
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
|
||||
|
||||
// Создаем канал для остановки мониторинга
|
||||
stopChan := make(chan bool, 1)
|
||||
|
||||
// Запускаем горутину для обработки сигналов
|
||||
// Запускаем горутину для чтения клавиш
|
||||
go func() {
|
||||
<-sigChan
|
||||
stopChan <- true
|
||||
for {
|
||||
var input string
|
||||
fmt.Scanln(&input)
|
||||
if strings.ToLower(input) == "q" || strings.ToLower(input) == "й" {
|
||||
stopChan <- true
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
// Запускаем мониторинг
|
||||
@@ -50,9 +53,8 @@ func MonitorConnection() error {
|
||||
case <-ticker.C:
|
||||
clearScreen()
|
||||
displayRealtimeStatus(state)
|
||||
fmt.Printf("\n%s Нажмите 'q' и Enter для выхода\n", cyan("ℹ"))
|
||||
case <-stopChan:
|
||||
// Восстанавливаем обработку сигналов по умолчанию
|
||||
signal.Reset(os.Interrupt, syscall.SIGTERM)
|
||||
fmt.Println("\n\nВыход из мониторинга...")
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
return nil
|
||||
@@ -104,7 +106,7 @@ func displayRealtimeStatus(state *config.ConnectionState) {
|
||||
}
|
||||
|
||||
fmt.Println(strings.Repeat("═", 70))
|
||||
fmt.Printf("\n%s Обновление каждую секунду | Нажмите Ctrl+C для выхода\n",
|
||||
fmt.Printf("\n%s Нажмите 'q' и Enter для выхода\n",
|
||||
cyan("ℹ"))
|
||||
}
|
||||
|
||||
@@ -126,17 +128,39 @@ func displayVLESSStats(state *config.ConnectionState) {
|
||||
}
|
||||
}
|
||||
|
||||
// Проверяем, что процесс еще работает
|
||||
// Проверяем, что процесс еще работает (улучшенная проверка для Windows)
|
||||
if state.ProcessPID > 0 {
|
||||
process, err := os.FindProcess(state.ProcessPID)
|
||||
if err == nil {
|
||||
if err := process.Signal(os.Signal(nil)); err != nil {
|
||||
fmt.Printf("\n%s Процесс Xray не отвечает!\n", red("⚠"))
|
||||
}
|
||||
processRunning := checkProcessRunning(state.ProcessPID)
|
||||
if !processRunning {
|
||||
fmt.Printf("\n%s Процесс Xray не отвечает!\n", red("⚠"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checkProcessRunning проверяет, работает ли процесс
|
||||
func checkProcessRunning(pid int) bool {
|
||||
process, err := os.FindProcess(pid)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// На Windows FindProcess всегда успешен, нужна дополнительная проверка
|
||||
// Пытаемся получить информацию о процессе через tasklist
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd := exec.Command("tasklist", "/FI", fmt.Sprintf("PID eq %d", pid), "/NH")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
// Если процесс существует, в выводе будет его PID
|
||||
return strings.Contains(string(output), fmt.Sprintf("%d", pid))
|
||||
}
|
||||
|
||||
// На Unix используем сигнал 0
|
||||
err = process.Signal(syscall.Signal(0))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func displayWireGuardStats(state *config.ConnectionState) {
|
||||
fmt.Println("\n" + bold("WireGuard Туннель"))
|
||||
fmt.Printf("Интерфейс: %s\n", state.Interface)
|
||||
@@ -198,7 +222,8 @@ func ShowQuickStatus() string {
|
||||
duration := time.Since(startTime)
|
||||
hours := int(duration.Hours())
|
||||
minutes := int(duration.Minutes()) % 60
|
||||
timeStr = fmt.Sprintf(" [%02d:%02d]", hours, minutes)
|
||||
seconds := int(duration.Seconds()) % 60
|
||||
timeStr = fmt.Sprintf(" [%02d:%02d:%02d]", hours, minutes, seconds)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ var (
|
||||
SubscriptionsFile string
|
||||
ConfigsFile string
|
||||
StateFile string
|
||||
SettingsFile string
|
||||
LogsDir string
|
||||
XrayDir string
|
||||
V2RayDir string
|
||||
)
|
||||
|
||||
type WireGuardConfig struct {
|
||||
@@ -51,6 +53,10 @@ type ConnectionState struct {
|
||||
LogFile string `json:"log_file"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
CoreType string `json:"core_type"` // "xray" или "v2ray"
|
||||
}
|
||||
|
||||
// Init инициализирует конфигурационные директории и файлы
|
||||
func Init() error {
|
||||
// Получаем рабочую директорию
|
||||
@@ -63,8 +69,10 @@ func Init() error {
|
||||
SubscriptionsFile = filepath.Join(ConfigDir, "subscriptions.json")
|
||||
ConfigsFile = filepath.Join(ConfigDir, "configs.json")
|
||||
StateFile = filepath.Join(ConfigDir, "state.json")
|
||||
SettingsFile = filepath.Join(ConfigDir, "settings.json")
|
||||
LogsDir = filepath.Join(workDir, "logs")
|
||||
XrayDir = filepath.Join(workDir, "xray")
|
||||
V2RayDir = filepath.Join(workDir, "v2ray")
|
||||
|
||||
// Создаем директории
|
||||
if err := os.MkdirAll(ConfigDir, 0755); err != nil {
|
||||
@@ -84,6 +92,9 @@ func Init() error {
|
||||
if err := initFileIfNotExists(StateFile, ConnectionState{}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := initFileIfNotExists(SettingsFile, Settings{CoreType: "xray"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -170,3 +181,32 @@ func SaveState(state *ConnectionState) error {
|
||||
}
|
||||
return os.WriteFile(StateFile, data, 0644)
|
||||
}
|
||||
|
||||
// LoadSettings загружает настройки
|
||||
func LoadSettings() (*Settings, error) {
|
||||
data, err := os.ReadFile(SettingsFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var settings Settings
|
||||
if err := json.Unmarshal(data, &settings); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// По умолчанию xray
|
||||
if settings.CoreType == "" {
|
||||
settings.CoreType = "xray"
|
||||
}
|
||||
|
||||
return &settings, nil
|
||||
}
|
||||
|
||||
// SaveSettings сохраняет настройки
|
||||
func SaveSettings(settings *Settings) error {
|
||||
data, err := json.MarshalIndent(settings, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(SettingsFile, data, 0644)
|
||||
}
|
||||
|
||||
273
internal/downloader/downloader.go
Normal file
273
internal/downloader/downloader.go
Normal file
@@ -0,0 +1,273 @@
|
||||
package downloader
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
const (
|
||||
XrayVersion = "24.12.18"
|
||||
V2RayVersion = "5.22.0"
|
||||
XrayDownloadURL = "https://github.com/XTLS/Xray-core/releases/download/v%s/Xray-windows-64.zip"
|
||||
V2RayDownloadURL = "https://github.com/v2fly/v2ray-core/releases/download/v%s/v2ray-windows-64.zip"
|
||||
)
|
||||
|
||||
var (
|
||||
green = color.New(color.FgGreen).SprintFunc()
|
||||
yellow = color.New(color.FgYellow).SprintFunc()
|
||||
cyan = color.New(color.FgCyan).SprintFunc()
|
||||
)
|
||||
|
||||
// DownloadCore загружает Xray или V2Ray
|
||||
func DownloadCore(coreDir, coreName string) error {
|
||||
var downloadURL, version, exeName string
|
||||
|
||||
if coreName == "xray" {
|
||||
downloadURL = fmt.Sprintf(XrayDownloadURL, XrayVersion)
|
||||
version = XrayVersion
|
||||
exeName = "xray.exe"
|
||||
} else if coreName == "v2ray" {
|
||||
downloadURL = fmt.Sprintf(V2RayDownloadURL, V2RayVersion)
|
||||
version = V2RayVersion
|
||||
exeName = "v2ray.exe"
|
||||
} else {
|
||||
return fmt.Errorf("неизвестный тип ядра: %s", coreName)
|
||||
}
|
||||
|
||||
// Проверяем, существует ли уже
|
||||
coreExe := filepath.Join(coreDir, exeName)
|
||||
if _, err := os.Stat(coreExe); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Println("\n" + strings.Repeat("=", 60))
|
||||
fmt.Printf("%s %s не найден. Начинаю загрузку...\n", yellow("⚠"), strings.ToUpper(coreName))
|
||||
fmt.Println(strings.Repeat("=", 60))
|
||||
|
||||
// Создаем директорию
|
||||
if err := os.MkdirAll(coreDir, 0755); err != nil {
|
||||
return fmt.Errorf("ошибка создания директории: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("\nВерсия: %s\n", cyan(version))
|
||||
fmt.Printf("URL: %s\n\n", downloadURL)
|
||||
|
||||
// Загружаем файл
|
||||
zipPath := filepath.Join(coreDir, coreName+".zip")
|
||||
if err := downloadFile(zipPath, downloadURL); err != nil {
|
||||
return fmt.Errorf("ошибка загрузки: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("\n%s Загрузка завершена\n", green("✓"))
|
||||
fmt.Printf("%s Распаковка архива...\n", yellow("⚙"))
|
||||
|
||||
// Распаковываем
|
||||
if err := unzip(zipPath, coreDir); err != nil {
|
||||
os.Remove(zipPath)
|
||||
return fmt.Errorf("ошибка распаковки: %w", err)
|
||||
}
|
||||
|
||||
os.Remove(zipPath)
|
||||
|
||||
fmt.Printf("%s %s успешно установлен в %s\n", green("✓"), strings.ToUpper(coreName), coreDir)
|
||||
fmt.Println(strings.Repeat("=", 60))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DownloadXray загружает Xray
|
||||
func DownloadXray(xrayDir string) error {
|
||||
return DownloadCore(xrayDir, "xray")
|
||||
}
|
||||
|
||||
// DownloadV2Ray загружает V2Ray
|
||||
func DownloadV2Ray(v2rayDir string) error {
|
||||
return DownloadCore(v2rayDir, "v2ray")
|
||||
}
|
||||
|
||||
// downloadFile загружает файл с прогресс-баром
|
||||
func downloadFile(filepath string, url string) error {
|
||||
out, err := os.Create(filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer out.Close()
|
||||
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("ошибка загрузки: HTTP %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
size := resp.ContentLength
|
||||
counter := &WriteCounter{Total: size}
|
||||
|
||||
_, err = io.Copy(out, io.TeeReader(resp.Body, counter))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
return nil
|
||||
}
|
||||
|
||||
// WriteCounter считает загруженные байты
|
||||
type WriteCounter struct {
|
||||
Total int64
|
||||
Downloaded int64
|
||||
}
|
||||
|
||||
func (wc *WriteCounter) Write(p []byte) (int, error) {
|
||||
n := len(p)
|
||||
wc.Downloaded += int64(n)
|
||||
wc.PrintProgress()
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (wc *WriteCounter) PrintProgress() {
|
||||
fmt.Printf("\r%s", strings.Repeat(" ", 60))
|
||||
percent := float64(wc.Downloaded) / float64(wc.Total) * 100
|
||||
downloaded := formatBytes(wc.Downloaded)
|
||||
total := formatBytes(wc.Total)
|
||||
fmt.Printf("\rЗагрузка: %s / %s (%.1f%%)", downloaded, total, percent)
|
||||
}
|
||||
|
||||
func formatBytes(bytes int64) string {
|
||||
const unit = 1024
|
||||
if bytes < unit {
|
||||
return fmt.Sprintf("%d B", bytes)
|
||||
}
|
||||
div, exp := int64(unit), 0
|
||||
for n := bytes / unit; n >= unit; n /= unit {
|
||||
div *= unit
|
||||
exp++
|
||||
}
|
||||
return fmt.Sprintf("%.1f %cB", float64(bytes)/float64(div), "KMGTPE"[exp])
|
||||
}
|
||||
|
||||
// unzip распаковывает zip архив
|
||||
func unzip(src, dest string) error {
|
||||
r, err := zip.OpenReader(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer r.Close()
|
||||
|
||||
for _, f := range r.File {
|
||||
fpath := filepath.Join(dest, f.Name)
|
||||
|
||||
if !strings.HasPrefix(fpath, filepath.Clean(dest)+string(os.PathSeparator)) {
|
||||
return fmt.Errorf("недопустимый путь файла: %s", fpath)
|
||||
}
|
||||
|
||||
if f.FileInfo().IsDir() {
|
||||
os.MkdirAll(fpath, os.ModePerm)
|
||||
continue
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(fpath), os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
outFile, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rc, err := f.Open()
|
||||
if err != nil {
|
||||
outFile.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = io.Copy(outFile, rc)
|
||||
outFile.Close()
|
||||
rc.Close()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckAndDownloadXray проверяет и загружает Xray
|
||||
func CheckAndDownloadXray(xrayDir string) error {
|
||||
if runtime.GOOS != "windows" {
|
||||
return nil
|
||||
}
|
||||
|
||||
xrayExe := filepath.Join(xrayDir, "xray.exe")
|
||||
if _, err := os.Stat(xrayExe); os.IsNotExist(err) {
|
||||
return DownloadXray(xrayDir)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckAndDownloadV2Ray проверяет и загружает V2Ray
|
||||
func CheckAndDownloadV2Ray(v2rayDir string) error {
|
||||
if runtime.GOOS != "windows" {
|
||||
return nil
|
||||
}
|
||||
|
||||
v2rayExe := filepath.Join(v2rayDir, "v2ray.exe")
|
||||
if _, err := os.Stat(v2rayExe); os.IsNotExist(err) {
|
||||
return DownloadV2Ray(v2rayDir)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckAndDownloadBoth проверяет и загружает оба ядра
|
||||
func CheckAndDownloadBoth(xrayDir, v2rayDir string) error {
|
||||
if runtime.GOOS != "windows" {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Проверяем Xray
|
||||
xrayExe := filepath.Join(xrayDir, "xray.exe")
|
||||
xrayExists := true
|
||||
if _, err := os.Stat(xrayExe); os.IsNotExist(err) {
|
||||
xrayExists = false
|
||||
}
|
||||
|
||||
// Проверяем V2Ray
|
||||
v2rayExe := filepath.Join(v2rayDir, "v2ray.exe")
|
||||
v2rayExists := true
|
||||
if _, err := os.Stat(v2rayExe); os.IsNotExist(err) {
|
||||
v2rayExists = false
|
||||
}
|
||||
|
||||
// Если оба есть, ничего не делаем
|
||||
if xrayExists && v2rayExists {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Загружаем недостающие
|
||||
if !xrayExists {
|
||||
if err := DownloadXray(xrayDir); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if !v2rayExists {
|
||||
if err := DownloadV2Ray(v2rayDir); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
22
internal/proxy/proxy_unix.go
Normal file
22
internal/proxy/proxy_unix.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// +build !windows
|
||||
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// EnableSystemProxy включает системный прокси (заглушка для Unix)
|
||||
func EnableSystemProxy(proxyAddr string) error {
|
||||
return fmt.Errorf("автоматическая настройка системного прокси не поддерживается на этой платформе")
|
||||
}
|
||||
|
||||
// DisableSystemProxy отключает системный прокси (заглушка для Unix)
|
||||
func DisableSystemProxy() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSystemProxyStatus проверяет статус системного прокси (заглушка для Unix)
|
||||
func GetSystemProxyStatus() (bool, string, error) {
|
||||
return false, "", nil
|
||||
}
|
||||
111
internal/proxy/proxy_windows.go
Normal file
111
internal/proxy/proxy_windows.go
Normal file
@@ -0,0 +1,111 @@
|
||||
// +build windows
|
||||
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// EnableSystemProxy включает системный прокси в Windows
|
||||
func EnableSystemProxy(proxyAddr string) error {
|
||||
// Включаем прокси через реестр
|
||||
cmd := exec.Command("reg", "add",
|
||||
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
|
||||
"/v", "ProxyEnable",
|
||||
"/t", "REG_DWORD",
|
||||
"/d", "1",
|
||||
"/f")
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("ошибка включения прокси: %w", err)
|
||||
}
|
||||
|
||||
// Устанавливаем адрес прокси
|
||||
cmd = exec.Command("reg", "add",
|
||||
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
|
||||
"/v", "ProxyServer",
|
||||
"/t", "REG_SZ",
|
||||
"/d", fmt.Sprintf("socks=%s", proxyAddr),
|
||||
"/f")
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("ошибка установки адреса прокси: %w", err)
|
||||
}
|
||||
|
||||
// Обновляем настройки Internet Explorer (применяет изменения)
|
||||
refreshIESettings()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DisableSystemProxy отключает системный прокси в Windows
|
||||
func DisableSystemProxy() error {
|
||||
// Отключаем прокси
|
||||
cmd := exec.Command("reg", "add",
|
||||
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
|
||||
"/v", "ProxyEnable",
|
||||
"/t", "REG_DWORD",
|
||||
"/d", "0",
|
||||
"/f")
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("ошибка отключения прокси: %w", err)
|
||||
}
|
||||
|
||||
// Очищаем адрес прокси
|
||||
cmd = exec.Command("reg", "delete",
|
||||
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
|
||||
"/v", "ProxyServer",
|
||||
"/f")
|
||||
|
||||
cmd.Run() // Игнорируем ошибку, если ключ не существует
|
||||
|
||||
// Обновляем настройки
|
||||
refreshIESettings()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSystemProxyStatus проверяет статус системного прокси
|
||||
func GetSystemProxyStatus() (bool, string, error) {
|
||||
// Проверяем, включен ли прокси
|
||||
cmd := exec.Command("reg", "query",
|
||||
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
|
||||
"/v", "ProxyEnable")
|
||||
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return false, "", nil
|
||||
}
|
||||
|
||||
enabled := strings.Contains(string(output), "0x1")
|
||||
|
||||
// Получаем адрес прокси
|
||||
cmd = exec.Command("reg", "query",
|
||||
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
|
||||
"/v", "ProxyServer")
|
||||
|
||||
output, err = cmd.Output()
|
||||
proxyAddr := ""
|
||||
if err == nil {
|
||||
lines := strings.Split(string(output), "\n")
|
||||
for _, line := range lines {
|
||||
if strings.Contains(line, "ProxyServer") {
|
||||
parts := strings.Fields(line)
|
||||
if len(parts) >= 3 {
|
||||
proxyAddr = parts[len(parts)-1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return enabled, proxyAddr, nil
|
||||
}
|
||||
|
||||
func refreshIESettings() {
|
||||
// Используем rundll32 для обновления настроек Internet Explorer
|
||||
cmd := exec.Command("rundll32.exe", "inetcpl.cpl,ClearMyTracksByProcess", "8")
|
||||
cmd.Run()
|
||||
}
|
||||
@@ -11,10 +11,12 @@ import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"vpn-client/internal/config"
|
||||
"vpn-client/internal/logger"
|
||||
"vpn-client/internal/proxy"
|
||||
)
|
||||
|
||||
// XrayConfig представляет конфигурацию Xray
|
||||
@@ -331,7 +333,35 @@ func getParam(params map[string]string, key, defaultValue string) string {
|
||||
}
|
||||
|
||||
// Connect подключается к VLESS серверу
|
||||
func Connect(configName string, logsDir, xrayDir string) error {
|
||||
func Connect(configName string, logsDir string) error {
|
||||
// Загружаем настройки
|
||||
settings, err := config.LoadSettings()
|
||||
if err != nil {
|
||||
return fmt.Errorf("ошибка загрузки настроек: %w", err)
|
||||
}
|
||||
|
||||
// Определяем директорию и имя исполняемого файла
|
||||
var coreDir, coreExe, coreName string
|
||||
if settings.CoreType == "v2ray" {
|
||||
coreDir = config.V2RayDir
|
||||
coreName = "V2Ray"
|
||||
if runtime.GOOS == "windows" {
|
||||
coreExe = "v2ray.exe"
|
||||
} else {
|
||||
coreExe = "v2ray"
|
||||
}
|
||||
} else {
|
||||
coreDir = config.XrayDir
|
||||
coreName = "Xray"
|
||||
if runtime.GOOS == "windows" {
|
||||
coreExe = "xray.exe"
|
||||
} else {
|
||||
coreExe = "xray"
|
||||
}
|
||||
}
|
||||
|
||||
corePath := filepath.Join(coreDir, coreExe)
|
||||
|
||||
// Загружаем конфигурации
|
||||
configs, err := config.LoadConfigs()
|
||||
if err != nil {
|
||||
@@ -351,15 +381,15 @@ func Connect(configName string, logsDir, xrayDir string) error {
|
||||
return fmt.Errorf("конфиг '%s' не найден", configName)
|
||||
}
|
||||
|
||||
// Создаем конфигурацию Xray
|
||||
xrayConfig, err := ParseVLESSURL(vlessConfig.URL, logsDir)
|
||||
// Создаем конфигурацию
|
||||
coreConfig, err := ParseVLESSURL(vlessConfig.URL, logsDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ошибка парсинга VLESS URL: %w", err)
|
||||
}
|
||||
|
||||
// Сохраняем конфигурацию
|
||||
configPath := filepath.Join(config.ConfigDir, "xray_config.json")
|
||||
data, err := json.MarshalIndent(xrayConfig, "", " ")
|
||||
data, err := json.MarshalIndent(coreConfig, "", " ")
|
||||
if err != nil {
|
||||
return fmt.Errorf("ошибка сериализации конфига: %w", err)
|
||||
}
|
||||
@@ -368,15 +398,9 @@ func Connect(configName string, logsDir, xrayDir string) error {
|
||||
return fmt.Errorf("ошибка сохранения конфига: %w", err)
|
||||
}
|
||||
|
||||
// Путь к xray
|
||||
xrayExe := "xray"
|
||||
if runtime.GOOS == "windows" {
|
||||
xrayExe = "xray.exe"
|
||||
}
|
||||
xrayPath := filepath.Join(xrayDir, xrayExe)
|
||||
|
||||
if _, err := os.Stat(xrayPath); os.IsNotExist(err) {
|
||||
return fmt.Errorf("xray не найден в %s", xrayDir)
|
||||
// Проверяем наличие исполняемого файла
|
||||
if _, err := os.Stat(corePath); os.IsNotExist(err) {
|
||||
return fmt.Errorf("%s не найден в %s\n\nПожалуйста, перезапустите приложение для автоматической загрузки %s", coreName, coreDir, coreName)
|
||||
}
|
||||
|
||||
// Создаем лог-файл трафика
|
||||
@@ -389,27 +413,70 @@ func Connect(configName string, logsDir, xrayDir string) error {
|
||||
// Записываем заголовок
|
||||
fmt.Fprintf(logFile, "=== VPN Подключение начато: %s ===\n", time.Now().Format("2006-01-02 15:04:05"))
|
||||
fmt.Fprintf(logFile, "Конфиг: %s\n", configName)
|
||||
fmt.Fprintf(logFile, "Клиент: Xray\n")
|
||||
fmt.Fprintf(logFile, "Клиент: %s\n", coreName)
|
||||
fmt.Fprintf(logFile, "Прокси: 127.0.0.1:10808\n")
|
||||
fmt.Fprintf(logFile, "%s\n\n", strings.Repeat("=", 60))
|
||||
|
||||
// Запускаем xray
|
||||
cmd := exec.Command(xrayPath, "run", "-c", configPath)
|
||||
// Запускаем ядро
|
||||
cmd := exec.Command(corePath, "run", "-c", configPath)
|
||||
cmd.Stdout = logFile
|
||||
cmd.Stderr = logFile
|
||||
|
||||
// На Windows создаем процесс в новой группе, чтобы Ctrl+C не убивал его
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||
CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP,
|
||||
}
|
||||
}
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
logFile.Close()
|
||||
return fmt.Errorf("ошибка запуска xray: %w", err)
|
||||
return fmt.Errorf("ошибка запуска %s: %w", coreName, err)
|
||||
}
|
||||
|
||||
// Ждем немного для проверки запуска
|
||||
time.Sleep(3 * time.Second)
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
// Проверяем, что процесс еще работает
|
||||
if err := cmd.Process.Signal(os.Signal(nil)); err != nil {
|
||||
// Проверяем, что процесс еще работает (для Windows используем другой метод)
|
||||
processRunning := true
|
||||
if runtime.GOOS == "windows" {
|
||||
// На Windows просто проверяем, что процесс существует
|
||||
process, err := os.FindProcess(cmd.Process.Pid)
|
||||
if err != nil {
|
||||
processRunning = false
|
||||
} else {
|
||||
// Пытаемся отправить сигнал 0 (проверка существования)
|
||||
err = process.Signal(syscall.Signal(0))
|
||||
// На Windows это всегда возвращает ошибку, поэтому просто считаем что процесс работает
|
||||
processRunning = true
|
||||
}
|
||||
} else {
|
||||
// На Unix используем стандартную проверку
|
||||
err := cmd.Process.Signal(syscall.Signal(0))
|
||||
processRunning = (err == nil)
|
||||
}
|
||||
|
||||
if !processRunning {
|
||||
logFile.Close()
|
||||
return fmt.Errorf("процесс xray завершился с ошибкой")
|
||||
|
||||
// Читаем логи для диагностики
|
||||
errorLog := filepath.Join(logsDir, "vless_error.log")
|
||||
if errorData, readErr := os.ReadFile(errorLog); readErr == nil && len(errorData) > 0 {
|
||||
lines := strings.Split(string(errorData), "\n")
|
||||
errorLines := []string{}
|
||||
for i := len(lines) - 1; i >= 0 && len(errorLines) < 10; i-- {
|
||||
if strings.TrimSpace(lines[i]) != "" {
|
||||
errorLines = append([]string{lines[i]}, errorLines...)
|
||||
}
|
||||
}
|
||||
|
||||
if len(errorLines) > 0 {
|
||||
return fmt.Errorf("процесс %s завершился с ошибкой.\n\nПоследние строки из лога ошибок:\n%s\n\nПолный лог: %s",
|
||||
coreName, strings.Join(errorLines, "\n"), errorLog)
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("процесс %s завершился с ошибкой.\nПроверьте логи в: %s", coreName, errorLog)
|
||||
}
|
||||
|
||||
// Сохраняем состояние
|
||||
@@ -418,7 +485,7 @@ func Connect(configName string, logsDir, xrayDir string) error {
|
||||
ConfigName: configName,
|
||||
ConfigType: "vless",
|
||||
StartTime: time.Now().Format(time.RFC3339),
|
||||
Interface: "xray",
|
||||
Interface: strings.ToLower(coreName),
|
||||
ProcessPID: cmd.Process.Pid,
|
||||
LogFile: trafficLog,
|
||||
}
|
||||
@@ -431,10 +498,37 @@ func Connect(configName string, logsDir, xrayDir string) error {
|
||||
|
||||
// Логируем успешное подключение
|
||||
logPath := logger.GetLogPath(logsDir, "vless")
|
||||
logger.LogMessage(logPath, fmt.Sprintf("Успешно подключено к '%s' (PID: %d, Лог: %s)", configName, cmd.Process.Pid, trafficLog))
|
||||
logger.LogMessage(logPath, fmt.Sprintf("Успешно подключено к '%s' через %s (PID: %d, Лог: %s)", configName, coreName, cmd.Process.Pid, trafficLog))
|
||||
|
||||
fmt.Printf("✓ Подключено к '%s'\n", configName)
|
||||
fmt.Printf("✓ Подключено к '%s' через %s\n", configName, coreName)
|
||||
fmt.Printf("SOCKS5 прокси: 127.0.0.1:10808\n")
|
||||
|
||||
// Предлагаем настроить системный прокси
|
||||
fmt.Println("\n" + strings.Repeat("─", 60))
|
||||
fmt.Println("Настроить системный прокси Windows?")
|
||||
fmt.Println("Это позволит всем приложениям использовать VPN.")
|
||||
fmt.Print("(y/n): ")
|
||||
|
||||
var response string
|
||||
fmt.Scanln(&response)
|
||||
|
||||
if strings.ToLower(response) == "y" || strings.ToLower(response) == "д" {
|
||||
if err := proxy.EnableSystemProxy("127.0.0.1:10808"); err != nil {
|
||||
fmt.Printf("⚠ Не удалось настроить системный прокси: %v\n", err)
|
||||
fmt.Println("Вы можете настроить его вручную в настройках Windows")
|
||||
} else {
|
||||
fmt.Println("✓ Системный прокси настроен")
|
||||
}
|
||||
} else {
|
||||
fmt.Println("\nДля использования VPN настройте прокси вручную:")
|
||||
fmt.Println(" 1. Откройте Настройки Windows → Сеть и Интернет → Прокси")
|
||||
fmt.Println(" 2. Включите 'Использовать прокси-сервер'")
|
||||
fmt.Println(" 3. Адрес: 127.0.0.1, Порт: 10808")
|
||||
fmt.Println("\nИли настройте SOCKS5 прокси в браузере:")
|
||||
fmt.Println(" Firefox: Настройки → Основные → Параметры сети")
|
||||
fmt.Println(" Chrome: Настройки → Система → Открыть настройки прокси")
|
||||
}
|
||||
|
||||
fmt.Printf("\nЛоги трафика:\n")
|
||||
fmt.Printf(" - Основной: %s\n", trafficLog)
|
||||
fmt.Printf(" - Доступ (IP): %s\n", filepath.Join(logsDir, "vless_access.log"))
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"vpn-client/internal/config"
|
||||
"vpn-client/internal/logger"
|
||||
"vpn-client/internal/proxy"
|
||||
"vpn-client/internal/wireguard"
|
||||
)
|
||||
|
||||
@@ -84,6 +85,16 @@ func Disconnect(logsDir string) error {
|
||||
return fmt.Errorf("ошибка сохранения состояния: %w", err)
|
||||
}
|
||||
|
||||
// Отключаем системный прокси если был VLESS
|
||||
if state.ConfigType == "vless" {
|
||||
if err := proxy.DisableSystemProxy(); err != nil {
|
||||
fmt.Printf("%s Не удалось отключить системный прокси: %v\n", "⚠", err)
|
||||
fmt.Println("Отключите его вручную в настройках Windows")
|
||||
} else {
|
||||
fmt.Println("✓ Системный прокси отключен")
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println("✓ Отключено от VPN")
|
||||
return nil
|
||||
}
|
||||
|
||||
15
main_cli.go
15
main_cli.go
@@ -7,6 +7,7 @@ import (
|
||||
"vpn-client/internal/admin"
|
||||
"vpn-client/internal/cli"
|
||||
"vpn-client/internal/config"
|
||||
"vpn-client/internal/downloader"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -19,9 +20,23 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Проверка и загрузка Xray и V2Ray
|
||||
fmt.Println("Проверка наличия Xray и V2Ray...")
|
||||
if err := downloader.CheckAndDownloadBoth(config.XrayDir, config.V2RayDir); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Ошибка загрузки ядер: %v\n", err)
|
||||
fmt.Println("\nНажмите Enter для выхода...")
|
||||
fmt.Scanln()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Запуск CLI
|
||||
if err := cli.Run(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Ошибка: %v\n", err)
|
||||
fmt.Println("\nНажмите Enter для выхода...")
|
||||
fmt.Scanln()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Нормальный выход
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
144
v2ray/config.json
Normal file
144
v2ray/config.json
Normal file
@@ -0,0 +1,144 @@
|
||||
// Config file of V2Ray. This file follows standard JSON format, with comments support.
|
||||
// Uncomment entries below to satisfy your needs. Also read our manual for more detail at
|
||||
// https://www.v2fly.org/
|
||||
{
|
||||
"log": {
|
||||
// By default, V2Ray writes access log to stdout.
|
||||
// "access": "/path/to/access/log/file",
|
||||
|
||||
// By default, V2Ray write error log to stdout.
|
||||
// "error": "/path/to/error/log/file",
|
||||
|
||||
// Log level, one of "debug", "info", "warning", "error", "none"
|
||||
"loglevel": "warning"
|
||||
},
|
||||
// List of inbound proxy configurations.
|
||||
"inbounds": [{
|
||||
// Port to listen on. You may need root access if the value is less than 1024.
|
||||
"port": 1080,
|
||||
|
||||
// IP address to listen on. Change to "0.0.0.0" to listen on all network interfaces.
|
||||
"listen": "127.0.0.1",
|
||||
|
||||
// Tag of the inbound proxy. May be used for routing.
|
||||
"tag": "socks-inbound",
|
||||
|
||||
// Protocol name of inbound proxy.
|
||||
"protocol": "socks",
|
||||
|
||||
// Settings of the protocol. Varies based on protocol.
|
||||
"settings": {
|
||||
"auth": "noauth",
|
||||
"udp": false,
|
||||
"ip": "127.0.0.1"
|
||||
},
|
||||
|
||||
// Enable sniffing on TCP connection.
|
||||
"sniffing": {
|
||||
"enabled": true,
|
||||
// Target domain will be overriden to the one carried by the connection, if the connection is HTTP or HTTPS.
|
||||
"destOverride": ["http", "tls"]
|
||||
}
|
||||
}],
|
||||
// List of outbound proxy configurations.
|
||||
"outbounds": [{
|
||||
// Protocol name of the outbound proxy.
|
||||
"protocol": "freedom",
|
||||
|
||||
// Settings of the protocol. Varies based on protocol.
|
||||
"settings": {},
|
||||
|
||||
// Tag of the outbound. May be used for routing.
|
||||
"tag": "direct"
|
||||
},{
|
||||
"protocol": "blackhole",
|
||||
"settings": {},
|
||||
"tag": "blocked"
|
||||
}],
|
||||
|
||||
// Transport is for global transport settings. If you have multiple transports with same settings
|
||||
// (say mKCP), you may put it here, instead of in each individual inbound/outbounds.
|
||||
//"transport": {},
|
||||
|
||||
// Routing controls how traffic from inbounds are sent to outbounds.
|
||||
"routing": {
|
||||
"domainStrategy": "IPOnDemand",
|
||||
"rules":[
|
||||
{
|
||||
// Blocks access to private IPs. Remove this if you want to access your router.
|
||||
"type": "field",
|
||||
"ip": ["geoip:private"],
|
||||
"outboundTag": "blocked"
|
||||
},
|
||||
{
|
||||
// Blocks major ads.
|
||||
"type": "field",
|
||||
"domain": ["geosite:category-ads"],
|
||||
"outboundTag": "blocked"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Dns settings for domain resolution.
|
||||
"dns": {
|
||||
// Static hosts, similar to hosts file.
|
||||
"hosts": {
|
||||
// Match v2fly.org to another domain on CloudFlare. This domain will be used when querying IPs for v2fly.org.
|
||||
"domain:v2fly.org": "www.vicemc.net",
|
||||
|
||||
// The following settings help to eliminate DNS poisoning in mainland China.
|
||||
// It is safe to comment these out if this is not the case for you.
|
||||
"domain:github.io": "pages.github.com",
|
||||
"domain:wikipedia.org": "www.wikimedia.org",
|
||||
"domain:shadowsocks.org": "electronicsrealm.com"
|
||||
},
|
||||
"servers": [
|
||||
"1.1.1.1",
|
||||
{
|
||||
"address": "114.114.114.114",
|
||||
"port": 53,
|
||||
// List of domains that use this DNS first.
|
||||
"domains": [
|
||||
"geosite:cn"
|
||||
]
|
||||
},
|
||||
"8.8.8.8",
|
||||
"localhost"
|
||||
]
|
||||
},
|
||||
|
||||
// Policy controls some internal behavior of how V2Ray handles connections.
|
||||
// It may be on connection level by user levels in 'levels', or global settings in 'system.'
|
||||
"policy": {
|
||||
// Connection policys by user levels
|
||||
"levels": {
|
||||
"0": {
|
||||
"uplinkOnly": 0,
|
||||
"downlinkOnly": 0
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
"statsInboundUplink": false,
|
||||
"statsInboundDownlink": false,
|
||||
"statsOutboundUplink": false,
|
||||
"statsOutboundDownlink": false
|
||||
}
|
||||
},
|
||||
|
||||
// Stats enables internal stats counter.
|
||||
// This setting can be used together with Policy and Api.
|
||||
//"stats":{},
|
||||
|
||||
// Api enables gRPC APIs for external programs to communicate with V2Ray instance.
|
||||
//"api": {
|
||||
//"tag": "api",
|
||||
//"services": [
|
||||
// "HandlerService",
|
||||
// "LoggerService",
|
||||
// "StatsService"
|
||||
//]
|
||||
//},
|
||||
|
||||
// You may add other entries to the configuration, but they will not be recognized by V2Ray.
|
||||
"other": {}
|
||||
}
|
||||
BIN
v2ray/geoip-only-cn-private.dat
Normal file
BIN
v2ray/geoip-only-cn-private.dat
Normal file
Binary file not shown.
BIN
v2ray/geoip.dat
Normal file
BIN
v2ray/geoip.dat
Normal file
Binary file not shown.
22209
v2ray/geosite.dat
Normal file
22209
v2ray/geosite.dat
Normal file
File diff suppressed because one or more lines are too long
25
v2ray/vpoint_socks_vmess.json
Normal file
25
v2ray/vpoint_socks_vmess.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"log": {
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"inbounds": [{
|
||||
"port": 1080,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "socks",
|
||||
"settings": {
|
||||
"auth": "noauth",
|
||||
"udp": false,
|
||||
"ip": "127.0.0.1"
|
||||
}
|
||||
}],
|
||||
"outbounds": [{
|
||||
"protocol": "freedom",
|
||||
"settings": {},
|
||||
"tag": "direct"
|
||||
}],
|
||||
"policy": {
|
||||
"levels": {
|
||||
"0": {"uplinkOnly": 0}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
v2ray/vpoint_vmess_freedom.json
Normal file
32
v2ray/vpoint_vmess_freedom.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"inbounds": [{
|
||||
"port": 10086,
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "23ad6b10-8d1a-40f7-8ad0-e3e35cd38297",
|
||||
"level": 1,
|
||||
"alterId": 64
|
||||
}
|
||||
]
|
||||
}
|
||||
}],
|
||||
"outbounds": [{
|
||||
"protocol": "freedom",
|
||||
"settings": {}
|
||||
},{
|
||||
"protocol": "blackhole",
|
||||
"settings": {},
|
||||
"tag": "blocked"
|
||||
}],
|
||||
"routing": {
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"ip": ["geoip:private"],
|
||||
"outboundTag": "blocked"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
373
xray/LICENSE
Normal file
373
xray/LICENSE
Normal file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
147
xray/README.md
Normal file
147
xray/README.md
Normal file
@@ -0,0 +1,147 @@
|
||||
# Project X
|
||||
|
||||
[Project X](https://github.com/XTLS) originates from XTLS protocol, providing a set of network tools such as [Xray-core](https://github.com/XTLS/Xray-core) and [REALITY](https://github.com/XTLS/REALITY).
|
||||
|
||||
[README](https://github.com/XTLS/Xray-core#readme) is open, so feel free to submit your project [here](https://github.com/XTLS/Xray-core/pulls).
|
||||
|
||||
## Donation & NFTs
|
||||
|
||||
- **ETH/USDT/USDC: `0xDc3Fe44F0f25D13CACb1C4896CD0D321df3146Ee`**
|
||||
- **Project X NFT: [Announcement of NFTs by Project X](https://github.com/XTLS/Xray-core/discussions/3633)**
|
||||
- **REALITY NFT: [XHTTP: Beyond REALITY](https://github.com/XTLS/Xray-core/discussions/4113)**
|
||||
|
||||
## License
|
||||
|
||||
[Mozilla Public License Version 2.0](https://github.com/XTLS/Xray-core/blob/main/LICENSE)
|
||||
|
||||
## Documentation
|
||||
|
||||
[Project X Official Website](https://xtls.github.io)
|
||||
|
||||
## Telegram
|
||||
|
||||
[Project X](https://t.me/projectXray)
|
||||
|
||||
[Project X Channel](https://t.me/projectXtls)
|
||||
|
||||
[Project VLESS](https://t.me/projectVless) (non-Chinese)
|
||||
|
||||
## Installation
|
||||
|
||||
- Linux Script
|
||||
- [XTLS/Xray-install](https://github.com/XTLS/Xray-install) (**Official**)
|
||||
- [tempest](https://github.com/team-cloudchaser/tempest) (supports [`systemd`](https://systemd.io) and [OpenRC](https://github.com/OpenRC/openrc); Linux-only)
|
||||
- Docker
|
||||
- [ghcr.io/xtls/xray-core](https://ghcr.io/xtls/xray-core) (**Official**)
|
||||
- [teddysun/xray](https://hub.docker.com/r/teddysun/xray)
|
||||
- [wulabing/xray_docker](https://github.com/wulabing/xray_docker)
|
||||
- Web Panel - **WARNING: Please DO NOT USE plain HTTP panels like 3X-UI**, as they are believed to be bribed by Iran GFW for supporting plain HTTP by default and refused to change (https://github.com/XTLS/Xray-core/pull/3884#issuecomment-2439595331), which has already put many users' data security in danger in the past few years. **If you are already using 3X-UI, please switch to the following panels, which are verified to support HTTPS and SSH port forwarding only:**
|
||||
- [Marzban](https://github.com/Gozargah/Marzban)
|
||||
- [Xray-UI](https://github.com/qist/xray-ui)
|
||||
- [Hiddify](https://github.com/hiddify/Hiddify-Manager)
|
||||
- One Click
|
||||
- [Xray-REALITY](https://github.com/zxcvos/Xray-script), [xray-reality](https://github.com/sajjaddg/xray-reality), [reality-ezpz](https://github.com/aleskxyz/reality-ezpz)
|
||||
- [Xray_bash_onekey](https://github.com/hello-yunshu/Xray_bash_onekey), [XTool](https://github.com/LordPenguin666/XTool)
|
||||
- [v2ray-agent](https://github.com/mack-a/v2ray-agent), [Xray_onekey](https://github.com/wulabing/Xray_onekey), [ProxySU](https://github.com/proxysu/ProxySU)
|
||||
- Magisk
|
||||
- [Xray4Magisk](https://github.com/Asterisk4Magisk/Xray4Magisk)
|
||||
- [Xray_For_Magisk](https://github.com/E7KMbb/Xray_For_Magisk)
|
||||
- Homebrew
|
||||
- `brew install xray`
|
||||
|
||||
## Usage
|
||||
|
||||
- Example
|
||||
- [VLESS-XTLS-uTLS-REALITY](https://github.com/XTLS/REALITY#readme)
|
||||
- [VLESS-TCP-XTLS-Vision](https://github.com/XTLS/Xray-examples/tree/main/VLESS-TCP-XTLS-Vision)
|
||||
- [All-in-One-fallbacks-Nginx](https://github.com/XTLS/Xray-examples/tree/main/All-in-One-fallbacks-Nginx)
|
||||
- Xray-examples
|
||||
- [XTLS/Xray-examples](https://github.com/XTLS/Xray-examples)
|
||||
- [chika0801/Xray-examples](https://github.com/chika0801/Xray-examples)
|
||||
- [lxhao61/integrated-examples](https://github.com/lxhao61/integrated-examples)
|
||||
- Tutorial
|
||||
- [XTLS Vision](https://github.com/chika0801/Xray-install)
|
||||
- [REALITY (English)](https://cscot.pages.dev/2023/03/02/Xray-REALITY-tutorial/)
|
||||
- [XTLS-Iran-Reality (English)](https://github.com/SasukeFreestyle/XTLS-Iran-Reality)
|
||||
- [Xray REALITY with 'steal oneself' (English)](https://computerscot.github.io/vless-xtls-utls-reality-steal-oneself.html)
|
||||
- [Xray with WireGuard inbound (English)](https://g800.pages.dev/wireguard)
|
||||
|
||||
## GUI Clients
|
||||
|
||||
- OpenWrt
|
||||
- [PassWall](https://github.com/xiaorouji/openwrt-passwall), [PassWall 2](https://github.com/xiaorouji/openwrt-passwall2)
|
||||
- [ShadowSocksR Plus+](https://github.com/fw876/helloworld)
|
||||
- [luci-app-xray](https://github.com/yichya/luci-app-xray) ([openwrt-xray](https://github.com/yichya/openwrt-xray))
|
||||
- Windows
|
||||
- [v2rayN](https://github.com/2dust/v2rayN)
|
||||
- [Furious](https://github.com/LorenEteval/Furious)
|
||||
- [Invisible Man - Xray](https://github.com/InvisibleManVPN/InvisibleMan-XRayClient)
|
||||
- Android
|
||||
- [v2rayNG](https://github.com/2dust/v2rayNG)
|
||||
- [X-flutter](https://github.com/XTLS/X-flutter)
|
||||
- [SaeedDev94/Xray](https://github.com/SaeedDev94/Xray)
|
||||
- iOS & macOS arm64
|
||||
- [FoXray](https://apps.apple.com/app/foxray/id6448898396)
|
||||
- [Streisand](https://apps.apple.com/app/streisand/id6450534064)
|
||||
- macOS arm64 & x64
|
||||
- [V2rayU](https://github.com/yanue/V2rayU)
|
||||
- [V2RayXS](https://github.com/tzmax/V2RayXS)
|
||||
- [Furious](https://github.com/LorenEteval/Furious)
|
||||
- [FoXray](https://apps.apple.com/app/foxray/id6448898396)
|
||||
- Linux
|
||||
- [v2rayA](https://github.com/v2rayA/v2rayA)
|
||||
- [Furious](https://github.com/LorenEteval/Furious)
|
||||
|
||||
## Others that support VLESS, XTLS, REALITY, XUDP, PLUX...
|
||||
|
||||
- iOS & macOS arm64
|
||||
- [Shadowrocket](https://apps.apple.com/app/shadowrocket/id932747118)
|
||||
- Xray Tools
|
||||
- [xray-knife](https://github.com/lilendian0x00/xray-knife)
|
||||
- Xray Wrapper
|
||||
- [XTLS/libXray](https://github.com/XTLS/libXray)
|
||||
- [xtlsapi](https://github.com/hiddify/xtlsapi)
|
||||
- [AndroidLibXrayLite](https://github.com/2dust/AndroidLibXrayLite)
|
||||
- [Xray-core-python](https://github.com/LorenEteval/Xray-core-python)
|
||||
- [xray-api](https://github.com/XVGuardian/xray-api)
|
||||
- [XrayR](https://github.com/XrayR-project/XrayR)
|
||||
- [XrayR-release](https://github.com/XrayR-project/XrayR-release)
|
||||
- [XrayR-V2Board](https://github.com/missuo/XrayR-V2Board)
|
||||
- [Clash.Meta](https://github.com/MetaCubeX/Clash.Meta)
|
||||
- [clashN](https://github.com/2dust/clashN)
|
||||
- [Clash Meta for Android](https://github.com/MetaCubeX/ClashMetaForAndroid)
|
||||
- [sing-box](https://github.com/SagerNet/sing-box)
|
||||
|
||||
## Contributing
|
||||
|
||||
[Code of Conduct](https://github.com/XTLS/Xray-core/blob/main/CODE_OF_CONDUCT.md)
|
||||
|
||||
## Credits
|
||||
|
||||
- [Xray-core v1.0.0](https://github.com/XTLS/Xray-core/releases/tag/v1.0.0) was forked from [v2fly-core 9a03cc5](https://github.com/v2fly/v2ray-core/commit/9a03cc5c98d04cc28320fcee26dbc236b3291256), and we have made & accumulated a huge number of enhancements over time, check [the release notes for each version](https://github.com/XTLS/Xray-core/releases).
|
||||
- For third-party projects used in [Xray-core](https://github.com/XTLS/Xray-core), check your local or [the latest go.mod](https://github.com/XTLS/Xray-core/blob/main/go.mod).
|
||||
|
||||
## Compilation
|
||||
|
||||
### Windows (PowerShell)
|
||||
|
||||
```powershell
|
||||
$env:CGO_ENABLED=0
|
||||
go build -o xray.exe -trimpath -ldflags "-s -w -buildid=" ./main
|
||||
```
|
||||
|
||||
### Linux / macOS
|
||||
|
||||
```bash
|
||||
CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main
|
||||
```
|
||||
|
||||
### Reproducible Releases
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
## Stargazers over time
|
||||
|
||||
[](https://starchart.cc/XTLS/Xray-core)
|
||||
BIN
xray/geoip.dat
Normal file
BIN
xray/geoip.dat
Normal file
Binary file not shown.
22209
xray/geosite.dat
Normal file
22209
xray/geosite.dat
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user