搜尋套件、儲存庫與 APP 分類

套件詳情v2.0.0

flutter_v2ray

一個允許您建立 v2ray 連接的外掛程式(VPN 模式與僅代理模式)

AndroidiOS
近 30 天下載
2210
喜歡數
98
Pub 分數
160

安裝套件

flutter pub add flutter_v2ray

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

flutter_v2ray 是一個 Flutter 插件,可在 Android 和 iOS 設備上啟用 V2Ray 連線,支援 VPN 模式和僅代理設定。它允許開發者將安全、可自訂的網路路由整合到其應用程式中,以存取受限制的內容或私人網路服務。該插件提供簡單的介面來建立和管理 V2Ray 連線,利用原生平台功能實現穩定的效能。在需要進階網路功能並具備強大隱私控制的應用中特別有用。

適用情境

  • 安全的應用程式到伺服器通訊
  • 繞過地區內容限制
  • 建構注重隱私的應用程式
  • 整合自定義代理設定
  • 啟用加密網路隧道

主要特色

  • 支援 VPN 模式和僅代理連接類型
  • 跨平台相容性(Android 與 iOS)
  • 原生整合,性能穩定
  • 連接管理的簡單API
  • 可透過 V2Ray JSON 設定進行設定

適合對象

  • 開發安全通訊應用的開發者
  • 需要繞過網路限制的應用程式
  • 注重隱私的行動應用程式
  • 網路工具整合
  • 自訂代理解決方案

使用建議

  • 需要在 Android 和 iOS 上具備適當的系統權限
  • 可能需要為複雜的 V2Ray 設置進行額外配置
  • 由於VPN功能,可能導致應用商店審核挑戰
  • 某些操作依賴外部 V2Ray 二進制檔案
  • 未經進階設定,不適用於基本HTTP請求

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

flutter_v2ray

Open Source Love

Table of contents

Change logs

1.0.10
  • update xray core version to 25.3.6
see more

Features

  • Run V2Ray Proxy & VPN Mode
  • Get Server Delay
  • Parsing V2Ray sharing links and making changes to them

Supported Platforms

Platform Status Info
Android Done ✅ Xray 25.3.6
IOS Done ✅ For purchase: t.me/blueboy_tm
Desktop Done ✅ For purchase: t.me/blueboy_tm

Get started

Add dependency

You can use the command to add flutter_v2ray as a dependency with the latest stable version:

$ flutter pub add flutter_v2ray

Or you can manually add flutter_v2ray into the dependencies section in your pubspec.yaml:

dependencies:
  flutter_v2ray: ^replace-with-latest-version

Examples

URL Parser
import 'package:flutter_v2ray/flutter_v2ray.dart';

// v2ray share link like vmess://, vless://, ...
String link = "link_here";
V2RayURL parser = FlutterV2ray.parseFromURL(link);

// Remark of the v2ray
print(parser.remark);

// generate full v2ray configuration (json)
print(parser.getFullConfiguration());
Edit Configuration
// Change v2ray listening port
parser.inbound['port'] = 10890;
// Change v2ray listening host
parser.inbound['listen'] = '0.0.0.0';
// Change v2ray log level
parser.log['loglevel'] = 'info';
// Change v2ray dns
parser.dns = {
    "servers": ["1.1.1.1"]
};
// and ...

// generate configuration with new settings
parser.getFullConfiguration()

Making V2Ray connection
import 'package:flutter_v2ray/flutter_v2ray.dart';

final FlutterV2ray flutterV2ray = FlutterV2ray(
    onStatusChanged: (status) {
        // do something
    },
);

// You must initialize V2Ray before using it.
await flutterV2ray.initializeV2Ray();



// v2ray share link like vmess://, vless://, ...
String link = "link_here";
V2RayURL parser = FlutterV2ray.parseFromURL(link);


// Get Server Delay
print('${flutterV2ray.getServerDelay(config: parser.getFullConfiguration())}ms');

// Permission is not required if you using proxy only
if (await flutterV2ray.requestPermission()){
    flutterV2ray.startV2Ray(
        remark: parser.remark,
        // The use of parser.getFullConfiguration() is not mandatory,
        // and you can enter the desired V2Ray configuration in JSON format
        config: parser.getFullConfiguration(),
        blockedApps: null,
        bypassSubnets: null,
        proxyOnly: false,
    );
}

// Disconnect
flutterV2ray.stopV2Ray();

Bypass LAN Traffic
final List<String> subnets = [
    "0.0.0.0/5",
    "8.0.0.0/7",
    "11.0.0.0/8",
    "12.0.0.0/6",
    "16.0.0.0/4",
    "32.0.0.0/3",
    "64.0.0.0/2",
    "128.0.0.0/3",
    "160.0.0.0/5",
    "168.0.0.0/6",
    "172.0.0.0/12",
    "172.32.0.0/11",
    "172.64.0.0/10",
    "172.128.0.0/9",
    "173.0.0.0/8",
    "174.0.0.0/7",
    "176.0.0.0/4",
    "192.0.0.0/9",
    "192.128.0.0/11",
    "192.160.0.0/13",
    "192.169.0.0/16",
    "192.170.0.0/15",
    "192.172.0.0/14",
    "192.176.0.0/12",
    "192.192.0.0/10",
    "193.0.0.0/8",
    "194.0.0.0/7",
    "196.0.0.0/6",
    "200.0.0.0/5",
    "208.0.0.0/4",
    "240.0.0.0/4",
];

flutterV2ray.startV2Ray(
    remark: parser.remark,
    config: parser.getFullConfiguration(),
    blockedApps: null,
    bypassSubnets: subnets,
    proxyOnly: false,
);

Android configuration before publish to Google Play🚀

gradle.preperties
  • add this line
android.bundle.enableUncompressedNativeLibs = false
build.gradle (app)
  • Find the buildTypes block:
buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
               signingConfig signingConfigs.release
        }
    }
  • And replace it with the following configuration info:
splits {
        abi {
            enable true
            reset()
            //noinspection ChromeOsAbiSupport
            include "x86_64", "armeabi-v7a", "arm64-v8a"

            universalApk true
        }
    }

   buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
               signingConfig signingConfigs.release
               ndk {
                //noinspection ChromeOsAbiSupport
                abiFilters "x86_64", "armeabi-v7a", "arm64-v8a"
                debugSymbolLevel 'FULL'
            }
        }
    }

More examples

Credits

badvpn (tun2socks) Copyright (C) Ambroz Bizjak

All rights reserved.

Donation

If you liked this package, you can support me with one of the following links.

Buy me a coffee

Buy Me A Coffee

Cryptocurrency
  • BTC:
    • bc1qrtq0ygmxw7meak3ukvxn03za2j7t7s4uxuujct
  • Tron
    • TVQQdim3pxa4XoZyRRVHQ8GsY42rEgB4ow
  • USDT
    • TRC20
      • TVQQdim3pxa4XoZyRRVHQ8GsY42rEgB4ow
    • ERC20
      • 0xD5d931BB40F02Ed45172faebD805B3f0ba70Fe73
  • DogeCoin
    • DNFaHFzmUfeUB6NFgQX1sLn9q8kknTmKd8

所屬分類

依賴

依賴清單 1 項

  • plugin_platform_interface^2.0.2

原始碼儲存庫

使用此套件的專案