iwalkalone/wgrest-api
最新稳定版本:v1.0
Composer 安装命令:
composer require iwalkalone/wgrest-api
包简介
A class to use wgrest API
README 文档
README
Description
Class to use wgrest API and automate Wireguard.
Install
Install with composer:
composer require iwalkalone/wgrest-api
Or a specific version:
composer require iwalkalone/wgrest-api ^1.0
What supports now
For now it just implements adding and deleting peers.
How to use it
$wgrest = new \iwalkalone\WgRestApi([
'bearer_token' => 'you-token',
'base_uri' => 'http://127.0.0.1:8000',
]);
// To add a peer, we just have to pass interface, endpoint and a list of allowed ips
$data = $wgrest->addPeer('wg0', '1.2.3.4:12345', ['10.10.0.0/32']);
// $data contains the response in array format
// you should save url_safe_public_key to delete the peer in the future
// To delete a peer, we just have to pass interface and the public key we just saved
$url_safe_public_key = $data['url_safe_public_key'];
$data = $wgrest->deletePeer('wg0', $url_safe_public_key);
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2026-03-03