패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.3

wireguard_flutter

와이어그라운드 플러터 SDK

AndroidiOSmacOSWindowsLinux
30일 다운로드
872
좋아요
36
Pub 점수
120

패키지 설치

flutter pub add wireguard_flutter

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Wireguard Flutter SDK는 Flutter 애플리케이션에서 안전하고 고성능의 VPN 연결을 가능하게 합니다. 이 SDK는 Android, iOS, macOS, Windows, Linux용으로 크로스플랫폼 방식의 WireGuard 프로토콜 구현을 제공하여 개발자가 암호화된 네트워크 터널을 앱에 통합할 수 있도록 합니다. 구성 관리 및 터널 라이프사이클 제어를 간소화하여 개인정보 보호 중심 또는 기업용 네트워킹 기능에 적합합니다. 성능과 보안을 고려해 설계되었으며, 백엔드에서는 네이티브 WireGuard 구현을 활용합니다.

사용 사례

  • 안전한 앱에서 서버로의 통신
  • 모바일 앱에서의 개인 네트워크 접근
  • 엔터프라이즈 등급 원격 액세스
  • 장치 간 암호화된 데이터 전송
  • 지역 제한 회피

주요 기능

  • 크로스 플랫폼 지원
  • 내장형 WireGuard 통합
  • 간편한 터널 구성
  • 저지연 연결
  • 강력한 암호화 표준

적합한 대상

  • 안전한 메시징 앱을 개발하는 개발자
  • 개인 네트워크 액세스가 필요한 팀
  • 암호화된 데이터 채널이 필요한 앱
  • 개인정보 보호 중심 애플리케이션
  • 네트워크 인프라 구조 도구

고려 사항

  • 고급 구성에 대해 플랫폼별 설정이 필요합니다
  • 일부 플랫폼에서는 추가 권한이 필요할 수 있습니다
  • 비 VPN 사용 사례에는 적합하지 않습니다
  • 안정적인 네이티브 WireGuard 라이브러리에 의존
  • 에지 케이스에 대한 문서가 제한적

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

wireguard_flutter

A flutter plugin to setup and control VPN connection via Wireguard tunnel.

Contributing to wireguard_flutter

Thank you for your interest in contributing to wireguard_flutter! We appreciate your help in making this project better.

Before you start contributing, please take a moment to read the following guidelines.

How to Contribute

  1. Fork the repository to your GitHub account.
  2. Clone the forked repository to your local machine.
  3. Create a new branch for your contribution:
    git checkout -b feature/your-feature-name
    
  4. Make your changes and ensure that the code follows the project's coding standards.
  5. Commit your changes with a descriptive commit message:
    git commit -m "Add your descriptive message here"
    
  6. Push your changes to your forked repository:
    git push origin feature/your-feature-name
    
  7. Open a pull request in the original repository and provide a detailed description of your changes.

Usage

To use this plugin, add wireguard_flutter or visit Flutter Tutorial.

flutter pub add wireguard_flutter
Initialize

Initialize a wireguard instance with a valid name using initialize:

final wireguard = WireGuardFlutter.instance;

// initialize the interface
await wireguard.initialize(interfaceName: 'wg0');

and declare the .conf data:

const String conf = '''[Interface]
PrivateKey = 0IZmHsxiNQ54TsUs0EQ71JNsa5f70zVf1LmDvON1CXc=
Address = 10.8.0.4/32
DNS = 1.1.1.1


[Peer]
PublicKey = 6uZg6T0J1bHuEmdqPx8OmxQ2ebBJ8TnVpnCdV8jHliQ=
PresharedKey = As6JiXcYcqwjSHxSOrmQT13uGVlBG90uXZWmtaezZVs=
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 0
Endpoint = 38.180.13.85:51820''';

For more info on the configuration data, see the documentation with examples.

Connect

After initializing, connect using startVpn:

await wireguard.startVpn(
  serverAddress: address, // the server address (e.g 'demo.wireguard.com:51820')
  wgQuickConfig: conf, // the quick-config file
  providerBundleIdentifier: 'com.example', // your app identifier
);
Disconnect

After connecting, disconnect using stopVpn:

await wireguard.stopVpn();
Stage

Listen to stage change using vpnStageSnapshot:

wireguard.vpnStageSnapshot.listen((event) {
  debugPrint("status changed $event");
});

Or get the current stage using getStage:

final stage = await wireguard.stage();

The available stages are:

Code Description
connecting The interface is connecting
connected The interface is connected
disconnecting The interface is disconnecting
disconnected The interface is disconnected
waitingConnection Waiting for a user interaction
authenticating Authenticating with the server
reconnect Reconnecting the the interface
noConnection Any connection has not been made
preparing Preparing to connect
denied The connection has been denied by the system, usually by refused permissions
exiting Exiting the interface

Supported Platforms

Android iOS macOS Windows Linux
Version SDK 21+ 15.0+ 12+ 7+ Any
Windows

On Windows, the app must be run as administrator to be able to create and manipulate the tunnel. To debug the app, run flutter run from an elevated command prompt. To run the app normally, the system will request your app to be run as administrator. No code changes or external dependencies are required.

Linux
Install dependencies

The required dependencies need to be installed: wireguard and wireguard-tools.

On Ubuntu/Debian, use the following command to install the dependencies:

sudo apt install wireguard wireguard-tools openresolv

For other Linux distros, see this.

[!NOTE]

If openresolv is not installed in the system, configuration files with a DNS provided may not connect. See this issue for more information.

Initializing

When wireguard.initialize is called, the application will request your user password ([sudo] password for <user>:). This is necessary because wireguard must run as a root to be able to create AND manipulate the tunnels. This is true for either debug and release modes or a distributed executable.

[!CAUTION]

Do not run the app in root mode (e.g sudo ./executable, sudo flutter run), otherwise the connection will not be established.

FAQ & Troubleshooting

Linux error resolvconf: command not found

On Linux, you may receive the error resolvconf: command not found. This is because wireguard tried to adjust the nameserver. Make sure to install openresolv or not provide the "DNS" field.


"WireGuard" is a registered trademark of Jason A. Donenfeld.

Fork from mysteriumnetwork tunnel.

Many Thanks for Bruno D'Luka for help me.

카테고리

의존성

의존성 목록 3 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.