SingBoxLib 1.0.5
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SingBoxLib --version 1.0.5
NuGet\Install-Package SingBoxLib -Version 1.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SingBoxLib" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SingBoxLib --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SingBoxLib, 1.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SingBoxLib as a Cake Addin #addin nuget:?package=SingBoxLib&version=1.0.5 // Install SingBoxLib as a Cake Tool #tool nuget:?package=SingBoxLib&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SingBoxLib
Configure and run sing-box with ease. Based on sing-box's official documentation.
Usage examples
Mixed inbound with Trojan outbound and grpc transport with tls:
var config = new SingBoxConfig
{
Inbounds = new()
{
new MixedInbound
{
Listen = "127.0.0.1",
ListenPort = 2080
}
},
Outbounds = new()
{
new TrojanOutbound
{
Server = "yourserver.server",
Port = 443,
Password = "my top secret password!",
Transport = new GrpcTransport
{
ServiceName = "grpcSeviceNameGoesHere",
},
Tls = new()
{
Enabled = true,
ServerName = "sniGoesHere",
Alpn = new() { "listOfAplnsGoHere" }
}
}
}
};
Tun inbound:
var config = new SingBoxConfig
{
Inbounds = new()
{
new TunInbound
{
InterfaceName = "myTunInterface",
INet4Address = "172.19.0.1/30",
Stack = TunStacks.gVisor,
Mtu = 1500,
AutoRoute = true,
}
},
Route = new()
{
AutoDetectInterface = true
}
};
Parse profiles
At this moment the following formats are supported:
VMess
VLess
Shadowsocks
Trojan
Socks
Http
var myProfileUrl = "trojan://myLovelyPassword@myserver.server:443?security=tls&sni=mySni&type=grpc&serviceName=myGrpcPath#MyTrojanServer";
var myProfile = ProfileParser.ParseProfileUrl(myProfileUrl);
// convert to outbound and use directly in sing-box config:
var myOutbound = myProfile.ToOutboundConfig();
Additionally you can convert parsed profiles back to string url:
var myProfileUrl = myProfile.ToProfileUrl();
Url testing
You can use UrlTester
and ParallelUrlTester
classes to easily test if the proxies are healthy and valid
var myProfileUrl = "trojan://myLovelyPassword@myserver.server:443?security=tls&sni=mySni&type=grpc&serviceName=myGrpcPath#MyTrojanServer";
var myProfile = ProfileParser.ParseProfileUrl(myProfileUrl);
var urlTester = new UrlTester(
new SingBoxWrapper("sing-box-path"),
// local port
2080,
// timeout in miliseconds
3000,
// retry count (will still do the retries even if proxy works, returns fastest result)
5,
// url to test using the proxy, defauts to http://cp.cloudflare.com, optional
null
);
var testResult = await urlTester.TestAsync(myProfile);
Console.WriteLine($"Success: {testResult.Success}, Delay: {testResult.Delay}");
Parallel:
var parallelTester = new ParallelUrlTester(
new SingBoxWrapper("sing-box-path"),
// A list of open local ports, must be equal or bigger than total test thread count
// make sure they are not occupied by other applications running on your system
new int[] { 2080, 2081, 2082, 2083, 2084, 2085 },
// max number of concurrent testing
6,
// timeout in miliseconds
3000,
// retry count (will still do the retries even if proxy works, returns fastest result)
5,
// url to test using the proxy, defauts to http://cp.cloudflare.com, optional
null);
List<ProfileItem> profilesToTest = GetMyProfilesFormSomewhere();
var results = new ConcurrentBag<UrlTestResult>();
await parallelTester.ParallelTestAsync(profilesToTest, new Progress<UrlTestResult>((result =>
{
results.Add(result);
})), default(CancellationToken));
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- CliWrap (>= 3.6.4)
- Newtonsoft.Json (>= 13.0.3)
- UrlBase64 (>= 1.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SingBoxLib:
Package | Downloads |
---|---|
Pouyan.SingBox
quieckly to create a vpn client that's support v2ray protocols |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on SingBoxLib:
Repository | Stars |
---|---|
Mahdi0024/ProxyCollector
Automatically collects and tests v2ray proxies and puts them in github for everyone to use.
|
Version | Downloads | Last updated |
---|---|---|
1.1.11 | 8,346 | 12/1/2023 |
1.1.10 | 1,063 | 11/15/2023 |
1.1.9 | 429 | 11/15/2023 |
1.1.8 | 462 | 11/15/2023 |
1.1.7 | 435 | 11/15/2023 |
1.1.6 | 451 | 11/14/2023 |
1.1.5 | 443 | 11/14/2023 |
1.1.4 | 465 | 10/27/2023 |
1.1.2 | 524 | 10/17/2023 |
1.1.1 | 1,282 | 9/30/2023 |
1.1.0 | 509 | 9/25/2023 |
1.0.9 | 548 | 9/23/2023 |
1.0.8 | 1,027 | 9/20/2023 |
1.0.7 | 693 | 9/18/2023 |
1.0.6 | 550 | 9/18/2023 |
1.0.5 | 515 | 9/18/2023 |
1.0.4 | 554 | 9/18/2023 |
1.0.3 | 524 | 9/13/2023 |