mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 09:29:52 +03:00
Merge pull request #916 from dnobori/190528_jsonrpc_api
Merge pull request #916: Adding VPN Server Embedded HTML5-based Modern Admin Console, JSON-RPC API Suite and JSON-RPC Library for C#, JavaScript, TypeScript
This commit is contained in:
commit
2da6e4c491
5
.gitignore
vendored
5
.gitignore
vendored
@ -3,7 +3,10 @@
|
||||
.project
|
||||
.settings/
|
||||
Makefile
|
||||
bin/
|
||||
/src/bin/*
|
||||
!/src/bin/hamcore/
|
||||
/src/bin/hamcore/*
|
||||
!/src/bin/hamcore/wwwroot/
|
||||
build/
|
||||
cmake-build-debug/
|
||||
src/bin/hamcore/authors.txt
|
||||
|
36
README.md
36
README.md
@ -9,6 +9,9 @@
|
||||
* [For Ubuntu](#for-ubuntu)
|
||||
* [From binary installers:](#from-binary-installers)
|
||||
* [Build from Source code](#build-from-source-code)
|
||||
- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite)
|
||||
* [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console)
|
||||
* [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite)
|
||||
- [TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION](#to-circumvent-your-governments-firewall-restriction)
|
||||
- [SOURCE CODE CONTRIBUTION](#source-code-contribution)
|
||||
- [DEAR SECURITY EXPERTS](#dear-security-experts)
|
||||
@ -154,6 +157,39 @@ There are two flavours of SoftEtherVPN source code:
|
||||
1. Unstable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN
|
||||
2. Stable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
|
||||
|
||||
|
||||
# About HTML5-based Modern Admin Console and JSON-RPC API Suite
|
||||
|
||||
## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console
|
||||
We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server.
|
||||
|
||||
Access to the following URL from your favorite web browser.
|
||||
|
||||
```
|
||||
https://<vpn_server_hostname>:<port>/admin/
|
||||
```
|
||||
|
||||
For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by:
|
||||
|
||||
```
|
||||
https://192.168.0.1:5555/admin/
|
||||
```
|
||||
|
||||
Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server.
|
||||
|
||||
|
||||
## Built-in SoftEther Server VPN JSON-RPC API Suite
|
||||
The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions).
|
||||
|
||||
You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/)
|
||||
|
||||
- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API.
|
||||
You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.)
|
||||
- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server.
|
||||
- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment.
|
||||
- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available.
|
||||
|
||||
|
||||
# TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION
|
||||
|
||||
Because SoftEther VPN is overly strong tool to build a VPN tunnel,
|
||||
|
350
developer_tools/vpnserver-jsonrpc-clients/.gitignore
vendored
Normal file
350
developer_tools/vpnserver-jsonrpc-clients/.gitignore
vendored
Normal file
@ -0,0 +1,350 @@
|
||||
# Created by https://www.gitignore.io/api/visualstudio
|
||||
# Edit at https://www.gitignore.io/?templates=visualstudio
|
||||
|
||||
### VisualStudio ###
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- Backup*.rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# End of https://www.gitignore.io/api/visualstudio
|
14648
developer_tools/vpnserver-jsonrpc-clients/README.html
Normal file
14648
developer_tools/vpnserver-jsonrpc-clients/README.html
Normal file
File diff suppressed because it is too large
Load Diff
8735
developer_tools/vpnserver-jsonrpc-clients/README.md
Normal file
8735
developer_tools/vpnserver-jsonrpc-clients/README.md
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,282 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// JsonRpc.cs - JSON-RPC Client Utility Functions
|
||||
//
|
||||
// Automatically generated at 2019-05-29 18:21:39 by vpnserver-jsonrpc-codegen
|
||||
//
|
||||
// Licensed under the Apache License 2.0
|
||||
// Copyright (c) 2014-2019 SoftEther VPN Project
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Security;
|
||||
using System.Net.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SoftEther.JsonRpc
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal utility class
|
||||
/// </summary>
|
||||
static class ClientUtil
|
||||
{
|
||||
public const int DefaultMaxDepth = 8;
|
||||
|
||||
public static string NonNull(this string s) { if (s == null) return ""; else return s; }
|
||||
public static bool IsEmpty(this string str)
|
||||
{
|
||||
if (str == null || str.Trim().Length == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public static bool IsFilled(this string str) => !IsEmpty(str);
|
||||
|
||||
public static string ObjectToJson(this object obj, bool include_null = false, bool escape_html = false, int? max_depth = ClientUtil.DefaultMaxDepth, bool compact = false, bool reference_handling = false) => ClientUtil.Serialize(obj, include_null, escape_html, max_depth, compact, reference_handling);
|
||||
public static T JsonToObject<T>(this string str, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth) => ClientUtil.Deserialize<T>(str, include_null, max_depth);
|
||||
public static object JsonToObject(this string str, Type type, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth) => ClientUtil.Deserialize(str, type, include_null, max_depth);
|
||||
|
||||
public static string Serialize(object obj, bool include_null = false, bool escape_html = false, int? max_depth = ClientUtil.DefaultMaxDepth, bool compact = false, bool reference_handling = false)
|
||||
{
|
||||
JsonSerializerSettings setting = new JsonSerializerSettings()
|
||||
{
|
||||
MaxDepth = max_depth,
|
||||
NullValueHandling = include_null ? NullValueHandling.Include : NullValueHandling.Ignore,
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Error,
|
||||
PreserveReferencesHandling = reference_handling ? PreserveReferencesHandling.All : PreserveReferencesHandling.None,
|
||||
StringEscapeHandling = escape_html ? StringEscapeHandling.EscapeHtml : StringEscapeHandling.Default,
|
||||
};
|
||||
return JsonConvert.SerializeObject(obj, compact ? Formatting.None : Formatting.Indented, setting);
|
||||
}
|
||||
|
||||
public static T Deserialize<T>(string str, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth)
|
||||
=> (T)Deserialize(str, typeof(T), include_null, max_depth);
|
||||
|
||||
public static object Deserialize(string str, Type type, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth)
|
||||
{
|
||||
JsonSerializerSettings setting = new JsonSerializerSettings()
|
||||
{
|
||||
MaxDepth = max_depth,
|
||||
NullValueHandling = include_null ? NullValueHandling.Include : NullValueHandling.Ignore,
|
||||
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Error,
|
||||
};
|
||||
return JsonConvert.DeserializeObject(str, type, setting);
|
||||
}
|
||||
|
||||
public static void Print(this object o)
|
||||
{
|
||||
string str = o.ObjectToJson();
|
||||
|
||||
if (o is string) str = (string)o;
|
||||
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC exception class
|
||||
/// </summary>
|
||||
class JsonRpcException : Exception
|
||||
{
|
||||
public JsonRpcError RpcError { get; }
|
||||
public JsonRpcException(JsonRpcError err)
|
||||
: base($"Code={err.Code}, Message={err.Message.NonNull()}" +
|
||||
(err == null || err.Data == null ? "" : $", Data={err.Data.ObjectToJson(compact: true)}"))
|
||||
{
|
||||
this.RpcError = err;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC request class. See https://www.jsonrpc.org/specification
|
||||
/// </summary>
|
||||
class JsonRpcRequest
|
||||
{
|
||||
[JsonProperty("jsonrpc", Order = 1)]
|
||||
public string Version { get; set; } = "2.0";
|
||||
|
||||
[JsonProperty("id", Order = 2)]
|
||||
public string Id { get; set; } = null;
|
||||
|
||||
[JsonProperty("method", Order = 3)]
|
||||
public string Method { get; set; } = "";
|
||||
|
||||
[JsonProperty("params", Order = 4)]
|
||||
public object Params { get; set; } = null;
|
||||
|
||||
public JsonRpcRequest() { }
|
||||
|
||||
public JsonRpcRequest(string method, object param, string id)
|
||||
{
|
||||
this.Method = method;
|
||||
this.Params = param;
|
||||
this.Id = id;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC response class with generics
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
class JsonRpcResponse<TResult>
|
||||
{
|
||||
[JsonProperty("jsonrpc", Order = 1)]
|
||||
public virtual string Version { get; set; } = "2.0";
|
||||
|
||||
[JsonProperty("id", NullValueHandling = NullValueHandling.Include, Order = 2)]
|
||||
public virtual string Id { get; set; } = null;
|
||||
|
||||
[JsonProperty("result", Order = 3)]
|
||||
public virtual TResult Result { get; set; } = default(TResult);
|
||||
|
||||
[JsonProperty("error", Order = 4)]
|
||||
public virtual JsonRpcError Error { get; set; } = null;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual bool IsError => this.Error != null;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual bool IsOk => !IsError;
|
||||
|
||||
public virtual void ThrowIfError()
|
||||
{
|
||||
if (this.IsError) throw new JsonRpcException(this.Error);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.ObjectToJson(compact: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC error class. See https://www.jsonrpc.org/specification
|
||||
/// </summary>
|
||||
class JsonRpcError
|
||||
{
|
||||
public JsonRpcError() { }
|
||||
public JsonRpcError(int code, string message, object data = null)
|
||||
{
|
||||
this.Code = code;
|
||||
this.Message = message.NonNull();
|
||||
if (this.Message.IsEmpty()) this.Message = $"JSON-RPC Error {code}";
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
[JsonProperty("code")]
|
||||
public int Code { get; set; } = 0;
|
||||
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; } = null;
|
||||
|
||||
[JsonProperty("data")]
|
||||
public object Data { get; set; } = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC client. See https://www.jsonrpc.org/specification
|
||||
/// </summary>
|
||||
class JsonRpcClient
|
||||
{
|
||||
HttpClientHandler client_handler;
|
||||
HttpClient client;
|
||||
public const int DefaultTimeoutMsecs = 60 * 1000;
|
||||
public int TimeoutMsecs { get => (int)client.Timeout.TotalMilliseconds; set => client.Timeout = new TimeSpan(0, 0, 0, 0, value); }
|
||||
public Dictionary<string, string> HttpHeaders { get; } = new Dictionary<string, string>();
|
||||
|
||||
string base_url;
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC client class constructor
|
||||
/// </summary>
|
||||
/// <param name="url">The URL</param>
|
||||
/// <param name="cert_check_proc">The SSL certificate validation callback</param>
|
||||
public JsonRpcClient(string url, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> cert_check_proc = null)
|
||||
{
|
||||
if (cert_check_proc == null) cert_check_proc = (message, cert, chain, errors) => true;
|
||||
client_handler = new HttpClientHandler();
|
||||
|
||||
this.client_handler.AllowAutoRedirect = true;
|
||||
this.client_handler.MaxAutomaticRedirections = 10;
|
||||
|
||||
client_handler.ServerCertificateCustomValidationCallback = cert_check_proc;
|
||||
|
||||
client = new HttpClient(client_handler, true);
|
||||
//Console.WriteLine("new HttpClient(client_handler, true);");
|
||||
|
||||
this.base_url = url;
|
||||
|
||||
this.TimeoutMsecs = DefaultTimeoutMsecs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call a single RPC call (without error check). You can wait for the response with Task<string> or await statement.
|
||||
/// </summary>
|
||||
/// <param name="method_name">The name of RPC method</param>
|
||||
/// <param name="param">The parameters</param>
|
||||
public async Task<string> CallInternalAsync(string method_name, object param)
|
||||
{
|
||||
string id = DateTime.Now.Ticks.ToString();
|
||||
|
||||
JsonRpcRequest req = new JsonRpcRequest(method_name, param, id);
|
||||
|
||||
string req_string = req.ObjectToJson();
|
||||
|
||||
//Console.WriteLine($"req: {req_string}");
|
||||
|
||||
HttpContent content = new StringContent(req_string, Encoding.UTF8, "application/json");
|
||||
|
||||
foreach (string key in this.HttpHeaders.Keys)
|
||||
{
|
||||
string value = this.HttpHeaders[key];
|
||||
|
||||
content.Headers.Add(key, value);
|
||||
}
|
||||
|
||||
HttpResponseMessage response = await this.client.PostAsync(base_url, content);
|
||||
|
||||
Stream responseStream = await response.Content.ReadAsStreamAsync();
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
using (StreamReader streamReader = new StreamReader(responseStream))
|
||||
{
|
||||
throw new Exception($"Error: {response.StatusCode}: {await streamReader.ReadToEndAsync()}");
|
||||
}
|
||||
}
|
||||
|
||||
string ret_string;
|
||||
|
||||
using (StreamReader streamReader = new StreamReader(responseStream))
|
||||
{
|
||||
ret_string = await streamReader.ReadToEndAsync();
|
||||
}
|
||||
|
||||
//Console.WriteLine($"ret: {ret_string}");
|
||||
|
||||
return ret_string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call a single RPC call (with error check). You can wait for the response with Promise<TResult> or await statement. In the case of error, it will be thrown.
|
||||
/// </summary>
|
||||
/// <param name="method_name">The name of RPC method</param>
|
||||
/// <param name="param">The parameters</param>
|
||||
public async Task<TResult> CallAsync<TResult>(string method_name, object param)
|
||||
{
|
||||
string ret_string = await CallInternalAsync(method_name, param);
|
||||
|
||||
JsonRpcResponse <TResult> ret = ret_string.JsonToObject<JsonRpcResponse<TResult>>();
|
||||
|
||||
ret.ThrowIfError();
|
||||
|
||||
return ret.Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,17 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// Program.cs - The Main() entry point
|
||||
//
|
||||
// Automatically generated at 2019-05-29 18:21:39 by vpnserver-jsonrpc-codegen
|
||||
//
|
||||
// Licensed under the Apache License 2.0
|
||||
// Copyright (c) 2014-2019 SoftEther VPN Project
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
VPNRPCTest test = new VPNRPCTest();
|
||||
test.Test_All();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<RootNamespace>SoftEther.VPNServerRpc</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2041
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vpnserver-jsonrpc-client-csharp", "vpnserver-jsonrpc-client-csharp.csproj", "{81CA3EC4-026E-4D37-9889-828186BBB8C0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{81CA3EC4-026E-4D37-9889-828186BBB8C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{81CA3EC4-026E-4D37-9889-828186BBB8C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{81CA3EC4-026E-4D37-9889-828186BBB8C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{81CA3EC4-026E-4D37-9889-828186BBB8C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D87E5CF1-9A10-431C-AC42-F1041470AEE8}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
88
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/.gitignore
vendored
Normal file
88
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/.gitignore
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -0,0 +1,5 @@
|
||||
npm install
|
||||
|
||||
npm run build
|
||||
|
||||
npm publish
|
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=sample.d.ts.map
|
@ -0,0 +1 @@
|
||||
{"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../src/sample.ts"],"names":[],"mappings":""}
|
4146
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/dist/sample.js
vendored
Normal file
4146
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/dist/sample.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2721
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/dist/vpnrpc.d.ts
vendored
Normal file
2721
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/dist/vpnrpc.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
3825
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/dist/vpnrpc.js
vendored
Normal file
3825
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/dist/vpnrpc.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
529
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/package-lock.json
generated
Normal file
529
developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/package-lock.json
generated
Normal file
@ -0,0 +1,529 @@
|
||||
{
|
||||
"name": "vpnrpc",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
|
||||
"integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/highlight": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"@babel/highlight": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz",
|
||||
"integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.0.0",
|
||||
"esutils": "^2.0.2",
|
||||
"js-tokens": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.2.tgz",
|
||||
"integrity": "sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"big.js": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
|
||||
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"braces": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fill-range": "^7.0.1"
|
||||
}
|
||||
},
|
||||
"builtin-modules": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
|
||||
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||
"dev": true
|
||||
},
|
||||
"diff": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
|
||||
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
|
||||
"dev": true
|
||||
},
|
||||
"emojis-list": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
|
||||
"integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=",
|
||||
"dev": true
|
||||
},
|
||||
"enhanced-resolve": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz",
|
||||
"integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"memory-fs": "^0.4.0",
|
||||
"tapable": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"errno": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
|
||||
"integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"prr": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"dev": true
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
|
||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
||||
"dev": true
|
||||
},
|
||||
"fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.4",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
|
||||
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.1.15",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
|
||||
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
|
||||
"dev": true
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"dev": true
|
||||
},
|
||||
"is-number": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||
"dev": true
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
|
||||
"dev": true
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "3.13.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
|
||||
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"json5": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
|
||||
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"loader-utils": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz",
|
||||
"integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^2.0.0",
|
||||
"json5": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"memory-fs": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
|
||||
"integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"errno": "^0.1.3",
|
||||
"readable-stream": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
|
||||
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"braces": "^3.0.1",
|
||||
"picomatch": "^2.0.5"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
||||
"dev": true
|
||||
},
|
||||
"picomatch": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz",
|
||||
"integrity": "sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==",
|
||||
"dev": true
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
|
||||
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
|
||||
"dev": true
|
||||
},
|
||||
"prr": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
|
||||
"integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
|
||||
"dev": true
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
|
||||
"integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-parse": "^1.0.6"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.1.0.tgz",
|
||||
"integrity": "sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ==",
|
||||
"dev": true
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
||||
"dev": true
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"tapable": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz",
|
||||
"integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==",
|
||||
"dev": true
|
||||
},
|
||||
"to-regex-range": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-number": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"ts-loader": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-6.0.1.tgz",
|
||||
"integrity": "sha512-9H5ErTIw5t73sdSoFE0hX0RO45B7cdDA4pW1VIQ2wNFAhxSpZcAlv2fwMcfv6SAYLoI7uGwHuzC5dECzmzqtzA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.3.0",
|
||||
"enhanced-resolve": "^4.0.0",
|
||||
"loader-utils": "^1.0.2",
|
||||
"micromatch": "^4.0.0",
|
||||
"semver": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==",
|
||||
"dev": true
|
||||
},
|
||||
"tslint": {
|
||||
"version": "5.16.0",
|
||||
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.16.0.tgz",
|
||||
"integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"builtin-modules": "^1.1.1",
|
||||
"chalk": "^2.3.0",
|
||||
"commander": "^2.12.1",
|
||||
"diff": "^3.2.0",
|
||||
"glob": "^7.1.1",
|
||||
"js-yaml": "^3.13.0",
|
||||
"minimatch": "^3.0.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"resolve": "^1.3.2",
|
||||
"semver": "^5.3.0",
|
||||
"tslib": "^1.8.0",
|
||||
"tsutils": "^2.29.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
||||
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"tsutils": {
|
||||
"version": "2.29.0",
|
||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
|
||||
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tslib": "^1.8.1"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.4.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz",
|
||||
"integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==",
|
||||
"dev": true
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||
"dev": true
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "vpnrpc",
|
||||
"version": "1.0.1",
|
||||
"description": "",
|
||||
"main": "dist/vpnrpc.js",
|
||||
"scripts": {
|
||||
"prepare": "tsc",
|
||||
"build": "tsc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/SoftEtherVPN/SoftEtherVPN.git"
|
||||
},
|
||||
"keywords": [
|
||||
"vpn",
|
||||
"softether"
|
||||
],
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/SoftEtherVPN/SoftEtherVPN/issues"
|
||||
},
|
||||
"homepage": "https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/#readme",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2",
|
||||
"ts-loader": "^6.0.1",
|
||||
"tslint": "^5.16.0",
|
||||
"typescript": "^3.4.5"
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,72 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Basic Options */
|
||||
"target": "ES3", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2015.promise",
|
||||
"es5"
|
||||
], // "lib": [], /* Specify library files to be included in the compilation. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
"sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "./dist/", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src/", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"defaultSeverity": "warn",
|
||||
"extends": [
|
||||
"tslint:recommended"
|
||||
],
|
||||
"jsRules": {},
|
||||
"rules": {
|
||||
"comment-format": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"no-console": false,
|
||||
"prefer-const": false,
|
||||
"one-line": false,
|
||||
"only-arrow-functions": false,
|
||||
"space-before-function-paren": false,
|
||||
"trailing-comma": false,
|
||||
"no-empty": false,
|
||||
},
|
||||
"rulesDirectory": []
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
350
developer_tools/vpnserver-jsonrpc-codegen/.gitignore
vendored
Normal file
350
developer_tools/vpnserver-jsonrpc-codegen/.gitignore
vendored
Normal file
@ -0,0 +1,350 @@
|
||||
# Created by https://www.gitignore.io/api/visualstudio
|
||||
# Edit at https://www.gitignore.io/?templates=visualstudio
|
||||
|
||||
### VisualStudio ###
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- Backup*.rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# End of https://www.gitignore.io/api/visualstudio
|
2067
developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs
Normal file
2067
developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs
Normal file
File diff suppressed because it is too large
Load Diff
37
developer_tools/vpnserver-jsonrpc-codegen/Program.cs
Normal file
37
developer_tools/vpnserver-jsonrpc-codegen/Program.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json;
|
||||
using SoftEther.VPNServerRpc;
|
||||
using System.Text;
|
||||
using SoftEther.JsonRpc;
|
||||
|
||||
|
||||
namespace VPNServer_JSONRPC_CodeGen
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string output_dir = CodeGenUtil.OutputDir_Clients;
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(output_dir);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
CodeGen g = new CodeGen();
|
||||
|
||||
g.GenerateAndSaveCodes(output_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// Program.cs - The Main() entry point
|
||||
//
|
||||
// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen
|
||||
//
|
||||
// Licensed under the Apache License 2.0
|
||||
// Copyright (c) 2014-__YEAR__ SoftEther VPN Project
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
VPNRPCTest test = new VPNRPCTest();
|
||||
test.Test_All();
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<RootNamespace>SoftEther.VPNServerRpc</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2041
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vpnserver-jsonrpc-client-csharp", "vpnserver-jsonrpc-client-csharp.csproj", "{81CA3EC4-026E-4D37-9889-828186BBB8C0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{81CA3EC4-026E-4D37-9889-828186BBB8C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{81CA3EC4-026E-4D37-9889-828186BBB8C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{81CA3EC4-026E-4D37-9889-828186BBB8C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{81CA3EC4-026E-4D37-9889-828186BBB8C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D87E5CF1-9A10-431C-AC42-F1041470AEE8}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
77
developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt
Normal file
77
developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt
Normal file
@ -0,0 +1,77 @@
|
||||
# SoftEther VPN Server JSON-RPC API Suite Document
|
||||
This reference describes all JSON-RPC functions available on SoftEther VPN Server.
|
||||
|
||||
|
||||
You can access to the latest [SoftEther VPN Server JSON-RPC Document on GitHub](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/).
|
||||
|
||||
|
||||
## What is SoftEther VPN Server JSON-RPC API Suite?
|
||||
The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions).
|
||||
|
||||
- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API.
|
||||
- You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.)
|
||||
- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server.
|
||||
- No need to use any specific API client library since all APIs are provided on the [JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification). You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment.
|
||||
- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. [The Node.js Client Library for VPN Server RPC (vpnrpc)](https://www.npmjs.com/package/vpnrpc) package is also available.
|
||||
|
||||
|
||||
## Principle
|
||||
|
||||
### Entry point
|
||||
The entry point URL of JSON-RPC is:
|
||||
```
|
||||
https://<vpn_server_hostname>:<port>/api/
|
||||
```
|
||||
|
||||
- Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.
|
||||
- If you want to completely disable the JSON-RPC on your VPN Server, set the `DisableJsonRpcWebApi` variable to `true` on the `vpn_server.config`.
|
||||
|
||||
|
||||
### JSON-RPC specification
|
||||
You must use HTTPS 1.1 `POST` method to call each of JSON-RPC APIs.
|
||||
All APIs are based on the [JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification).
|
||||
- JSON-RPC Notification is not supported.
|
||||
- JSON-RPC Batch is not supported.
|
||||
|
||||
|
||||
### "vpnrpc": Node.js Client Library package for VPN Server JSON-RPC
|
||||
If you are willing to develop your original JSON-RPC client for SoftEther VPN, you can use the [JavaScript Client Library for VPN Server RPC (vpnrpc)](https://www.npmjs.com/package/vpnrpc).
|
||||
|
||||
- You can use the `vpnrpc` library in JavaScript for both web browsers (e.g. Chrome, FireFox or Edge) and Node.js.
|
||||
- As a sample code there is the [sample.ts](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/sample.ts) program in TypeScript. This sample calls all of available JSON-RPC APIs against the specified SoftEther VPN Server. (Note: This sample code is written in TypeScript.)
|
||||
|
||||
You can use the following command to download the `vpnrpc` library package with Node.js.
|
||||
```
|
||||
$ npm install --save-dev vpnrpc
|
||||
```
|
||||
|
||||
|
||||
|
||||
### "vpnrpc.ts": TypeScript Client Library for VPN Server JSON-RPC
|
||||
If you are willing to develop your original JSON-RPC client for SoftEther VPN, you can use the [TypeScript Client Library for VPN Server RPC (vpnrpc.ts)](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/).
|
||||
|
||||
- You can use the [vpnrpc.ts](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/vpnrpc.ts) library in TypeScript / JavaScript for both web browsers (e.g. Chrome, FireFox or Edge) and Node.js.
|
||||
- As a sample code there is the [sample.ts](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/sample.ts) program in TypeScript. This sample calls one by one all of available JSON-RPC APIs against the specified SoftEther VPN Server.
|
||||
|
||||
|
||||
### "vpnserver-jsonrpc-client-csharp": C# Client Library for VPN Server JSON-RPC
|
||||
If you are willing to develop your original JSON-RPC client for SoftEther VPN, you can use the [vpnserver-jsonrpc-client-csharp C# library](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-client-csharp/).
|
||||
|
||||
- The [client library codes for C#](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-client-csharp/rpc-stubs/) is written in pure C# 7.3. It works on .NET Core 2.1 or later on Windows, Linux and macOS. Very comfort with Visual Studio for both Windows or macOS.
|
||||
- As a sample code there is the [VpnServerRpcTest.cs](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-client-csharp/sample/VpnServerRpcTest.cs) program in C#. This sample calls one by one all of available JSON-RPC APIs against the specified SoftEther VPN Server.
|
||||
|
||||
|
||||
|
||||
### HTTPS Authentication
|
||||
You must specify the following HTTPS custom headers for authentication on each of requests.
|
||||
|
||||
|
||||
Value | Description
|
||||
--- | ---
|
||||
`X-VPNADMIN-HUBNAME` | The name of the Virtual Hub if you want to connect to the VPN Server as a Virtual Hub Admin Mode. Specify empty string if you want to connect to the VPN Server as the Entire VPN Server Admin Mode.
|
||||
`X-VPNADMIN-PASSWORD` | Specify the administration password.
|
||||
|
||||
|
||||
- You can omit the above HTTPS custom authentication headers if you are calling JSON-RPC APIs from the web browser which is already logged in to the VPN Server with HTTPS Basic Authentication. In such usage the credential of HTTPS Basic Authtication will be used.
|
||||
|
||||
***
|
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>SoftEther VPN Server JSON-RPC Suite Document</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.15.0/themes/prism.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.15.0/prism.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.15.0/components/prism-json.js"></script>
|
||||
<article class="markdown-body">
|
||||
__BODY__
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
576
developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt
Normal file
576
developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt
Normal file
@ -0,0 +1,576 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for TypeScript
|
||||
//
|
||||
// vpnrpc.ts
|
||||
// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen
|
||||
//
|
||||
// Licensed under the Apache License 2.0
|
||||
// Copyright (c) 2014-__YEAR__ SoftEther VPN Project
|
||||
|
||||
|
||||
// Trivial utility codes
|
||||
let is_node_js = (typeof navigator === "undefined") || navigator.userAgent.indexOf("Node.js") !== -1 || navigator.userAgent.indexOf("jsdom") !== -1;
|
||||
function is_null(obj: any)
|
||||
{
|
||||
return (typeof obj === "undefined") || (obj === null);
|
||||
}
|
||||
let debug_mode: boolean = false;
|
||||
|
||||
/** VPN Server RPC Stubs */
|
||||
export class VpnServerRpc
|
||||
{
|
||||
/** Determine if this JavaScript environment is on the Node.js or not. */
|
||||
public static IsNodeJS(): boolean
|
||||
{
|
||||
return is_node_js;
|
||||
}
|
||||
|
||||
/** Set the debug mode flag */
|
||||
public static SetDebugMode(flag: boolean): void
|
||||
{
|
||||
debug_mode = flag;
|
||||
}
|
||||
|
||||
private rpc_url: string;
|
||||
private rpc_client: JsonRpcClient;
|
||||
|
||||
/**
|
||||
* Constructor of the VpnServerRpc class
|
||||
* @param vpnserver_hostname The hostname or IP address of the destination VPN Server. In the web browser you can specify null if you want to connect to the server itself.
|
||||
* @param vpnserver_port The port number of the destination VPN Server. In the web browser you can specify null if you want to connect to the server itself.
|
||||
* @param hubname The name of the Virtual Hub if you want to connect to the VPN Server as a Virtual Hub Admin Mode. Specify null if you want to connect to the VPN Server as the Entire VPN Server Admin Mode.
|
||||
* @param password Specify the administration password. This value is valid only if vpnserver_hostname is sepcified.
|
||||
* @param nodejs_https_client_reject_untrusted_server_cert In Node.js set this true to check the SSL server certificate on the destination VPN Server. Set this false to ignore the SSL server certification.
|
||||
*/
|
||||
constructor(vpnserver_hostname?: string, vpnserver_port?: number, hubname?: string, password?: string, nodejs_https_client_reject_untrusted_server_cert?: boolean)
|
||||
{
|
||||
let headers: { [name: string]: string } = {};
|
||||
let send_credentials: boolean = false;
|
||||
|
||||
nodejs_https_client_reject_untrusted_server_cert = is_null(nodejs_https_client_reject_untrusted_server_cert) ? false : nodejs_https_client_reject_untrusted_server_cert!;
|
||||
|
||||
if (is_null(vpnserver_hostname))
|
||||
{
|
||||
this.rpc_url = "/api/";
|
||||
send_credentials = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_null(vpnserver_port)) vpnserver_port = 443;
|
||||
this.rpc_url = `https://${vpnserver_hostname}:${vpnserver_port}/api/`;
|
||||
|
||||
|
||||
headers["X-VPNADMIN-HUBNAME"] = is_null(hubname) ? "" : hubname!;
|
||||
headers["X-VPNADMIN-PASSWORD"] = is_null(password) ? "" : password!;
|
||||
}
|
||||
|
||||
if (is_null(nodejs_https_client_reject_untrusted_server_cert)) nodejs_https_client_reject_untrusted_server_cert = false;
|
||||
|
||||
this.rpc_client = new JsonRpcClient(this.rpc_url, headers, send_credentials, nodejs_https_client_reject_untrusted_server_cert);
|
||||
}
|
||||
|
||||
// --- Stubs ---
|
||||
__STUBS__
|
||||
|
||||
// -- Utility functions --
|
||||
/** Call a RPC procedure */
|
||||
public async CallAsync<T>(method_name: string, request: T): Promise<T>
|
||||
{
|
||||
let response: T = await this.rpc_client.CallAsync<T>(method_name, request);
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --- Types ---
|
||||
__TYPES__
|
||||
|
||||
|
||||
|
||||
// --- Utility codes ---
|
||||
|
||||
/** JSON-RPC request class. See https://www.jsonrpc.org/specification */
|
||||
export class JsonRpcRequest
|
||||
{
|
||||
public jsonrpc: string = "2.0";
|
||||
public method: string;
|
||||
public params: any;
|
||||
public id: string;
|
||||
|
||||
constructor(method: string = "", param: any = null, id: string = "")
|
||||
{
|
||||
this.method = method;
|
||||
this.params = param;
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
/** JSON-RPC error class. See https://www.jsonrpc.org/specification */
|
||||
export class JsonRpcError
|
||||
{
|
||||
public code: number;
|
||||
public message: string;
|
||||
public data: any;
|
||||
|
||||
constructor(code: number = 0, message: string = "", data: any = null)
|
||||
{
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
/** JSON-RPC response class with generics */
|
||||
export class JsonRpcResponse<TResult>
|
||||
{
|
||||
public jsonrpc: string = "2.0";
|
||||
public result: TResult = null!;
|
||||
public error: JsonRpcError = null!;
|
||||
public id: string = "";
|
||||
}
|
||||
|
||||
/** JSON-RPC client class. See https://www.jsonrpc.org/specification */
|
||||
export class JsonRpcClient
|
||||
{
|
||||
/** A utility function to convert any object to JSON string */
|
||||
public static ObjectToJson(obj: any): string
|
||||
{
|
||||
return JSON.stringify(obj,
|
||||
(key, value) =>
|
||||
{
|
||||
if (key.endsWith("_bin"))
|
||||
{
|
||||
return Util_Base64_Encode(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
, 4);
|
||||
}
|
||||
|
||||
/** A utility function to convert JSON string to object */
|
||||
public static JsonToObject(str: string): any
|
||||
{
|
||||
return JSON.parse(str,
|
||||
(key, value) =>
|
||||
{
|
||||
if (key.endsWith("_bin"))
|
||||
{
|
||||
return Util_Base64_Decode(value);
|
||||
}
|
||||
else if (key.endsWith("_dt"))
|
||||
{
|
||||
return new Date(value);
|
||||
}
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
/** Base URL */
|
||||
public BaseUrl: string;
|
||||
|
||||
/** The instance of HTTP client */
|
||||
private client: HttpClient;
|
||||
|
||||
/** Additional HTTP headers */
|
||||
private headers: { [name: string]: string };
|
||||
|
||||
/**
|
||||
* JSON-RPC client class constructor
|
||||
* @param url The URL
|
||||
* @param headers Additional HTTP headers
|
||||
* @param send_credential Set true to use the same credential with the browsing web site. Valid only if the code is running on the web browser.
|
||||
*/
|
||||
constructor(url: string, headers: { [name: string]: string }, send_credential: boolean, nodejs_https_client_reject_untrusted_server_cert: boolean)
|
||||
{
|
||||
this.BaseUrl = url;
|
||||
this.headers = headers;
|
||||
|
||||
this.client = new HttpClient();
|
||||
this.client.SendCredential = send_credential;
|
||||
this.client.NodeJS_HTTPS_Client_Reject_Unauthorized = nodejs_https_client_reject_untrusted_server_cert;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a single RPC call (without error check). You can wait for the response with Promise<string> or await statement.
|
||||
* @param method_name The name of RPC method
|
||||
* @param param The parameters
|
||||
*/
|
||||
public async CallInternalAsync(method_name: string, param: any): Promise<string>
|
||||
{
|
||||
let id = "1";
|
||||
|
||||
let req = new JsonRpcRequest(method_name, param, id);
|
||||
|
||||
let req_string = JsonRpcClient.ObjectToJson(req);
|
||||
|
||||
if (debug_mode)
|
||||
{
|
||||
console.log("--- RPC Request Body ---");
|
||||
console.log(req_string);
|
||||
console.log("------------------------");
|
||||
}
|
||||
|
||||
let http_response = await this.client.PostAsync(this.BaseUrl, this.headers,
|
||||
req_string, "application/json");
|
||||
|
||||
let ret_string = http_response.Body;
|
||||
|
||||
if (debug_mode)
|
||||
{
|
||||
console.log("--- RPC Response Body ---");
|
||||
console.log(ret_string);
|
||||
console.log("-------------------------");
|
||||
}
|
||||
|
||||
return ret_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a single RPC call (with error check). You can wait for the response with Promise<TResult> or await statement. In the case of error, it will be thrown.
|
||||
* @param method_name The name of RPC method
|
||||
* @param param The parameters
|
||||
*/
|
||||
public async CallAsync<TResult>(method_name: string, param: any): Promise<TResult>
|
||||
{
|
||||
let ret_string = await this.CallInternalAsync(method_name, param);
|
||||
|
||||
let ret: JsonRpcResponse<TResult> = JSON.parse(ret_string);
|
||||
|
||||
if (is_null(ret.error) === false)
|
||||
{
|
||||
throw new JsonRpcException(ret.error);
|
||||
}
|
||||
|
||||
return ret.result;
|
||||
}
|
||||
}
|
||||
|
||||
/** JSON-RPC exception class */
|
||||
export class JsonRpcException extends Error
|
||||
{
|
||||
public Error: JsonRpcError;
|
||||
|
||||
constructor(error: JsonRpcError)
|
||||
{
|
||||
super(`Code=${error.code}, Message=${error.message}`);
|
||||
this.Error = error;
|
||||
}
|
||||
}
|
||||
|
||||
/** HTTP client exception class */
|
||||
export class HttpClientException extends Error
|
||||
{
|
||||
constructor(message: string)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
/** HTTP client response class */
|
||||
export class HttpClientResponse
|
||||
{
|
||||
public Body: string = "";
|
||||
}
|
||||
|
||||
/** An HTTP client which can be used in both web browsers and Node.js */
|
||||
export class HttpClient
|
||||
{
|
||||
public TimeoutMsecs: number = 60 * 5 * 1000;
|
||||
public SendCredential: boolean = true;
|
||||
public NodeJS_HTTPS_Client_Reject_Unauthorized: boolean = false;
|
||||
|
||||
/** Post method. In web browsers this function will process the request by itself. In Node.js this function will call PostAsync_NodeJS() instead. */
|
||||
public async PostAsync(url: string, headers: { [name: string]: string },
|
||||
req_body: string, req_media_type: string): Promise<HttpClientResponse>
|
||||
{
|
||||
if (is_node_js)
|
||||
{
|
||||
return this.PostAsync_NodeJS(url, headers, req_body, req_media_type);
|
||||
}
|
||||
|
||||
let fetch_header_list = new Headers();
|
||||
|
||||
for (let name of Object.keys(headers))
|
||||
{
|
||||
fetch_header_list.append(name, headers[name]);
|
||||
}
|
||||
|
||||
let fetch_init: RequestInit =
|
||||
{
|
||||
mode: "cors",
|
||||
headers: fetch_header_list,
|
||||
credentials: (this.SendCredential ? "include" : "omit"),
|
||||
method: "POST",
|
||||
cache: "no-cache",
|
||||
keepalive: true,
|
||||
redirect: "follow",
|
||||
body: req_body,
|
||||
};
|
||||
|
||||
let fetch_response = await fetch(url, fetch_init);
|
||||
|
||||
if (fetch_response.ok === false)
|
||||
{
|
||||
throw new HttpClientException("HTTP Error: " + fetch_response.status + " " + fetch_response.statusText);
|
||||
}
|
||||
|
||||
let ret = new HttpClientResponse();
|
||||
|
||||
ret.Body = await fetch_response.text();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Post method for Node.js. */
|
||||
public PostAsync_NodeJS(url: string, headers: { [name: string]: string },
|
||||
req_body: string, req_media_type: string): Promise<HttpClientResponse>
|
||||
{
|
||||
const https = require("https");
|
||||
const keepAliveAgent = new https.Agent({ keepAlive: true });
|
||||
const urlparse = require("url");
|
||||
|
||||
const urlobj = urlparse.parse(url);
|
||||
|
||||
if (is_null(urlobj.host)) throw new Error("URL is invalid.");
|
||||
|
||||
let options =
|
||||
{
|
||||
host: urlobj.hostname,
|
||||
port: urlobj.port,
|
||||
path: urlobj.path,
|
||||
rejectUnauthorized: this.NodeJS_HTTPS_Client_Reject_Unauthorized,
|
||||
method: "POST",
|
||||
timeout: this.TimeoutMsecs,
|
||||
agent: keepAliveAgent,
|
||||
};
|
||||
|
||||
return new Promise(function (resolve, reject)
|
||||
{
|
||||
let req = https.request(options, (res: any) =>
|
||||
{
|
||||
if (res.statusCode !== 200)
|
||||
{
|
||||
reject(new HttpClientException("HTTP Error: " + res.statusCode + " " + res.statusMessage));
|
||||
}
|
||||
|
||||
let recv_str: string = "";
|
||||
|
||||
res.on("data", (body: any) =>
|
||||
{
|
||||
recv_str += body;
|
||||
});
|
||||
|
||||
res.on("end", () =>
|
||||
{
|
||||
let ret = new HttpClientResponse();
|
||||
|
||||
ret.Body = recv_str;
|
||||
|
||||
resolve(ret);
|
||||
});
|
||||
}).on("error", (err: any) =>
|
||||
{
|
||||
throw err;
|
||||
}
|
||||
);
|
||||
|
||||
for (let name of Object.keys(headers))
|
||||
{
|
||||
req.setHeader(name, !is_null(headers[name]) ? headers[name] : "");
|
||||
}
|
||||
req.setHeader("Content-Type", req_media_type);
|
||||
req.setHeader("Content-Length", Buffer.byteLength(req_body));
|
||||
req.write(req_body);
|
||||
req.end();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//////// BEGIN: Base64 encode / decode utility functions from https://github.com/beatgammit/base64-js
|
||||
// The MIT License(MIT)
|
||||
// Copyright(c) 2014
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files(the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
var lookup: any = [];
|
||||
var revLookup: any = [];
|
||||
|
||||
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
for (var i = 0, len = code.length; i < len; ++i)
|
||||
{
|
||||
lookup[i] = code[i];
|
||||
revLookup[code.charCodeAt(i)] = i;
|
||||
}
|
||||
|
||||
// Support decoding URL-safe base64 strings, as Node.js does.
|
||||
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||
revLookup["-".charCodeAt(0)] = 62;
|
||||
revLookup["_".charCodeAt(0)] = 63;
|
||||
|
||||
function getLens(b64: any)
|
||||
{
|
||||
var len = b64.length;
|
||||
|
||||
if (len % 4 > 0)
|
||||
{
|
||||
throw new Error("Invalid string. Length must be a multiple of 4");
|
||||
}
|
||||
|
||||
// Trim off extra bytes after placeholder bytes are found
|
||||
// See: https://github.com/beatgammit/base64-js/issues/42
|
||||
var validLen = b64.indexOf("=");
|
||||
if (validLen === -1) validLen = len;
|
||||
|
||||
var placeHoldersLen = validLen === len
|
||||
? 0
|
||||
: 4 - (validLen % 4);
|
||||
|
||||
return [validLen, placeHoldersLen];
|
||||
}
|
||||
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
function byteLength(b64: any)
|
||||
{
|
||||
var lens = getLens(b64);
|
||||
var validLen = lens[0];
|
||||
var placeHoldersLen = lens[1];
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen;
|
||||
}
|
||||
|
||||
function _byteLength(b64: any, validLen: any, placeHoldersLen: any)
|
||||
{
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen;
|
||||
}
|
||||
|
||||
export function Util_Base64_Decode(b64: any)
|
||||
{
|
||||
var tmp;
|
||||
var lens = getLens(b64);
|
||||
var validLen = lens[0];
|
||||
var placeHoldersLen = lens[1];
|
||||
|
||||
var arr = new Uint8Array(_byteLength(b64, validLen, placeHoldersLen));
|
||||
|
||||
var curByte = 0;
|
||||
|
||||
// if there are placeholders, only get up to the last complete 4 chars
|
||||
var len = placeHoldersLen > 0
|
||||
? validLen - 4
|
||||
: validLen;
|
||||
|
||||
for (var i = 0; i < len; i += 4)
|
||||
{
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 18) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
||||
revLookup[b64.charCodeAt(i + 3)];
|
||||
arr[curByte++] = (tmp >> 16) & 0xFF;
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF;
|
||||
arr[curByte++] = tmp & 0xFF;
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 2)
|
||||
{
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 2) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] >> 4);
|
||||
arr[curByte++] = tmp & 0xFF;
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 1)
|
||||
{
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 10) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] >> 2);
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF;
|
||||
arr[curByte++] = tmp & 0xFF;
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
function tripletToBase64(num: any)
|
||||
{
|
||||
return lookup[num >> 18 & 0x3F] +
|
||||
lookup[num >> 12 & 0x3F] +
|
||||
lookup[num >> 6 & 0x3F] +
|
||||
lookup[num & 0x3F];
|
||||
}
|
||||
|
||||
function encodeChunk(uint8: any, start: any, end: any)
|
||||
{
|
||||
var tmp;
|
||||
var output = [];
|
||||
for (var i = start; i < end; i += 3)
|
||||
{
|
||||
tmp =
|
||||
((uint8[i] << 16) & 0xFF0000) +
|
||||
((uint8[i + 1] << 8) & 0xFF00) +
|
||||
(uint8[i + 2] & 0xFF);
|
||||
output.push(tripletToBase64(tmp));
|
||||
}
|
||||
return output.join("");
|
||||
}
|
||||
|
||||
export function Util_Base64_Encode(uint8: any)
|
||||
{
|
||||
var tmp;
|
||||
var len = uint8.length;
|
||||
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
||||
var parts = [];
|
||||
var maxChunkLength = 16383; // must be multiple of 3
|
||||
|
||||
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)
|
||||
{
|
||||
parts.push(encodeChunk(
|
||||
uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
|
||||
));
|
||||
}
|
||||
|
||||
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||
if (extraBytes === 1)
|
||||
{
|
||||
tmp = uint8[len - 1];
|
||||
parts.push(
|
||||
lookup[tmp >> 2] +
|
||||
lookup[(tmp << 4) & 0x3F] +
|
||||
"=="
|
||||
);
|
||||
} else if (extraBytes === 2)
|
||||
{
|
||||
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
||||
parts.push(
|
||||
lookup[tmp >> 10] +
|
||||
lookup[(tmp >> 4) & 0x3F] +
|
||||
lookup[(tmp << 2) & 0x3F] +
|
||||
"="
|
||||
);
|
||||
}
|
||||
|
||||
return parts.join("");
|
||||
}
|
||||
//////// END: Base64 encode / decode utility functions from https://github.com/beatgammit/base64-js
|
||||
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
// Test sample code for SoftEther VPN Server JSON-RPC Stub
|
||||
// Runs on both web browsers and Node.js
|
||||
//
|
||||
// sample.ts
|
||||
// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen
|
||||
//
|
||||
// This sample code shows how to call all available RPC functions.
|
||||
// You can copy and paste test code to write your own web browser TypeScript / JavaScript codes.
|
||||
//
|
||||
// Licensed under the Apache License 2.0
|
||||
// Copyright (c) 2014-__YEAR__ SoftEther VPN Project
|
||||
|
||||
// On the web browser uncomment below imports as necessary to support old browsers.
|
||||
// import "core-js/es6/promise";
|
||||
// import "core-js/es6/string";
|
||||
// import "whatwg-fetch";
|
||||
|
||||
|
||||
// Import the vpnrpc.ts RPC stub.
|
||||
import * as VPN from "./vpnrpc";
|
||||
|
||||
// Output JSON-RPC request / reply strings to the debug console.
|
||||
VPN.VpnServerRpc.SetDebugMode(true);
|
||||
|
||||
let api: VPN.VpnServerRpc;
|
||||
// Creating the VpnServerRpc class instance here.
|
||||
if (VPN.VpnServerRpc.IsNodeJS() === false) // // Determine if this JavaScript environment is on the Node.js or not
|
||||
{
|
||||
// On the web browser. We do not need to specify any hostname, port or credential as the web browser already knows it.
|
||||
api = new VPN.VpnServerRpc();
|
||||
}
|
||||
else
|
||||
{
|
||||
// On the Node.js. We need to specify the target VPN Server's hostname, port and credential.
|
||||
api = new VPN.VpnServerRpc("127.0.0.1", 443, "", "PASSWORD_HERE", false);
|
||||
}
|
||||
|
||||
// A variable for test
|
||||
let hub_name = "test";
|
||||
|
||||
// Call the Test_All() function to test almost all VPN APIs.
|
||||
Test_All();
|
||||
|
||||
|
||||
|
||||
__TESTS__
|
||||
|
||||
|
@ -0,0 +1,282 @@
|
||||
// SoftEther VPN Server JSON-RPC Stub code for C#
|
||||
//
|
||||
// JsonRpc.cs - JSON-RPC Client Utility Functions
|
||||
//
|
||||
// Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen
|
||||
//
|
||||
// Licensed under the Apache License 2.0
|
||||
// Copyright (c) 2014-__YEAR__ SoftEther VPN Project
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Security;
|
||||
using System.Net.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SoftEther.JsonRpc
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal utility class
|
||||
/// </summary>
|
||||
static class ClientUtil
|
||||
{
|
||||
public const int DefaultMaxDepth = 8;
|
||||
|
||||
public static string NonNull(this string s) { if (s == null) return ""; else return s; }
|
||||
public static bool IsEmpty(this string str)
|
||||
{
|
||||
if (str == null || str.Trim().Length == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public static bool IsFilled(this string str) => !IsEmpty(str);
|
||||
|
||||
public static string ObjectToJson(this object obj, bool include_null = false, bool escape_html = false, int? max_depth = ClientUtil.DefaultMaxDepth, bool compact = false, bool reference_handling = false) => ClientUtil.Serialize(obj, include_null, escape_html, max_depth, compact, reference_handling);
|
||||
public static T JsonToObject<T>(this string str, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth) => ClientUtil.Deserialize<T>(str, include_null, max_depth);
|
||||
public static object JsonToObject(this string str, Type type, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth) => ClientUtil.Deserialize(str, type, include_null, max_depth);
|
||||
|
||||
public static string Serialize(object obj, bool include_null = false, bool escape_html = false, int? max_depth = ClientUtil.DefaultMaxDepth, bool compact = false, bool reference_handling = false)
|
||||
{
|
||||
JsonSerializerSettings setting = new JsonSerializerSettings()
|
||||
{
|
||||
MaxDepth = max_depth,
|
||||
NullValueHandling = include_null ? NullValueHandling.Include : NullValueHandling.Ignore,
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Error,
|
||||
PreserveReferencesHandling = reference_handling ? PreserveReferencesHandling.All : PreserveReferencesHandling.None,
|
||||
StringEscapeHandling = escape_html ? StringEscapeHandling.EscapeHtml : StringEscapeHandling.Default,
|
||||
};
|
||||
return JsonConvert.SerializeObject(obj, compact ? Formatting.None : Formatting.Indented, setting);
|
||||
}
|
||||
|
||||
public static T Deserialize<T>(string str, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth)
|
||||
=> (T)Deserialize(str, typeof(T), include_null, max_depth);
|
||||
|
||||
public static object Deserialize(string str, Type type, bool include_null = false, int? max_depth = ClientUtil.DefaultMaxDepth)
|
||||
{
|
||||
JsonSerializerSettings setting = new JsonSerializerSettings()
|
||||
{
|
||||
MaxDepth = max_depth,
|
||||
NullValueHandling = include_null ? NullValueHandling.Include : NullValueHandling.Ignore,
|
||||
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Error,
|
||||
};
|
||||
return JsonConvert.DeserializeObject(str, type, setting);
|
||||
}
|
||||
|
||||
public static void Print(this object o)
|
||||
{
|
||||
string str = o.ObjectToJson();
|
||||
|
||||
if (o is string) str = (string)o;
|
||||
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC exception class
|
||||
/// </summary>
|
||||
class JsonRpcException : Exception
|
||||
{
|
||||
public JsonRpcError RpcError { get; }
|
||||
public JsonRpcException(JsonRpcError err)
|
||||
: base($"Code={err.Code}, Message={err.Message.NonNull()}" +
|
||||
(err == null || err.Data == null ? "" : $", Data={err.Data.ObjectToJson(compact: true)}"))
|
||||
{
|
||||
this.RpcError = err;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC request class. See https://www.jsonrpc.org/specification
|
||||
/// </summary>
|
||||
class JsonRpcRequest
|
||||
{
|
||||
[JsonProperty("jsonrpc", Order = 1)]
|
||||
public string Version { get; set; } = "2.0";
|
||||
|
||||
[JsonProperty("id", Order = 2)]
|
||||
public string Id { get; set; } = null;
|
||||
|
||||
[JsonProperty("method", Order = 3)]
|
||||
public string Method { get; set; } = "";
|
||||
|
||||
[JsonProperty("params", Order = 4)]
|
||||
public object Params { get; set; } = null;
|
||||
|
||||
public JsonRpcRequest() { }
|
||||
|
||||
public JsonRpcRequest(string method, object param, string id)
|
||||
{
|
||||
this.Method = method;
|
||||
this.Params = param;
|
||||
this.Id = id;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC response class with generics
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
class JsonRpcResponse<TResult>
|
||||
{
|
||||
[JsonProperty("jsonrpc", Order = 1)]
|
||||
public virtual string Version { get; set; } = "2.0";
|
||||
|
||||
[JsonProperty("id", NullValueHandling = NullValueHandling.Include, Order = 2)]
|
||||
public virtual string Id { get; set; } = null;
|
||||
|
||||
[JsonProperty("result", Order = 3)]
|
||||
public virtual TResult Result { get; set; } = default(TResult);
|
||||
|
||||
[JsonProperty("error", Order = 4)]
|
||||
public virtual JsonRpcError Error { get; set; } = null;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual bool IsError => this.Error != null;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual bool IsOk => !IsError;
|
||||
|
||||
public virtual void ThrowIfError()
|
||||
{
|
||||
if (this.IsError) throw new JsonRpcException(this.Error);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.ObjectToJson(compact: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC error class. See https://www.jsonrpc.org/specification
|
||||
/// </summary>
|
||||
class JsonRpcError
|
||||
{
|
||||
public JsonRpcError() { }
|
||||
public JsonRpcError(int code, string message, object data = null)
|
||||
{
|
||||
this.Code = code;
|
||||
this.Message = message.NonNull();
|
||||
if (this.Message.IsEmpty()) this.Message = $"JSON-RPC Error {code}";
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
[JsonProperty("code")]
|
||||
public int Code { get; set; } = 0;
|
||||
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; } = null;
|
||||
|
||||
[JsonProperty("data")]
|
||||
public object Data { get; set; } = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC client. See https://www.jsonrpc.org/specification
|
||||
/// </summary>
|
||||
class JsonRpcClient
|
||||
{
|
||||
HttpClientHandler client_handler;
|
||||
HttpClient client;
|
||||
public const int DefaultTimeoutMsecs = 60 * 1000;
|
||||
public int TimeoutMsecs { get => (int)client.Timeout.TotalMilliseconds; set => client.Timeout = new TimeSpan(0, 0, 0, 0, value); }
|
||||
public Dictionary<string, string> HttpHeaders { get; } = new Dictionary<string, string>();
|
||||
|
||||
string base_url;
|
||||
|
||||
/// <summary>
|
||||
/// JSON-RPC client class constructor
|
||||
/// </summary>
|
||||
/// <param name="url">The URL</param>
|
||||
/// <param name="cert_check_proc">The SSL certificate validation callback</param>
|
||||
public JsonRpcClient(string url, Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> cert_check_proc = null)
|
||||
{
|
||||
if (cert_check_proc == null) cert_check_proc = (message, cert, chain, errors) => true;
|
||||
client_handler = new HttpClientHandler();
|
||||
|
||||
this.client_handler.AllowAutoRedirect = true;
|
||||
this.client_handler.MaxAutomaticRedirections = 10;
|
||||
|
||||
client_handler.ServerCertificateCustomValidationCallback = cert_check_proc;
|
||||
|
||||
client = new HttpClient(client_handler, true);
|
||||
//Console.WriteLine("new HttpClient(client_handler, true);");
|
||||
|
||||
this.base_url = url;
|
||||
|
||||
this.TimeoutMsecs = DefaultTimeoutMsecs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call a single RPC call (without error check). You can wait for the response with Task<string> or await statement.
|
||||
/// </summary>
|
||||
/// <param name="method_name">The name of RPC method</param>
|
||||
/// <param name="param">The parameters</param>
|
||||
public async Task<string> CallInternalAsync(string method_name, object param)
|
||||
{
|
||||
string id = DateTime.Now.Ticks.ToString();
|
||||
|
||||
JsonRpcRequest req = new JsonRpcRequest(method_name, param, id);
|
||||
|
||||
string req_string = req.ObjectToJson();
|
||||
|
||||
//Console.WriteLine($"req: {req_string}");
|
||||
|
||||
HttpContent content = new StringContent(req_string, Encoding.UTF8, "application/json");
|
||||
|
||||
foreach (string key in this.HttpHeaders.Keys)
|
||||
{
|
||||
string value = this.HttpHeaders[key];
|
||||
|
||||
content.Headers.Add(key, value);
|
||||
}
|
||||
|
||||
HttpResponseMessage response = await this.client.PostAsync(base_url, content);
|
||||
|
||||
Stream responseStream = await response.Content.ReadAsStreamAsync();
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
using (StreamReader streamReader = new StreamReader(responseStream))
|
||||
{
|
||||
throw new Exception($"Error: {response.StatusCode}: {await streamReader.ReadToEndAsync()}");
|
||||
}
|
||||
}
|
||||
|
||||
string ret_string;
|
||||
|
||||
using (StreamReader streamReader = new StreamReader(responseStream))
|
||||
{
|
||||
ret_string = await streamReader.ReadToEndAsync();
|
||||
}
|
||||
|
||||
//Console.WriteLine($"ret: {ret_string}");
|
||||
|
||||
return ret_string;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call a single RPC call (with error check). You can wait for the response with Promise<TResult> or await statement. In the case of error, it will be thrown.
|
||||
/// </summary>
|
||||
/// <param name="method_name">The name of RPC method</param>
|
||||
/// <param name="param">The parameters</param>
|
||||
public async Task<TResult> CallAsync<TResult>(string method_name, object param)
|
||||
{
|
||||
string ret_string = await CallInternalAsync(method_name, param);
|
||||
|
||||
JsonRpcResponse <TResult> ret = ret_string.JsonToObject<JsonRpcResponse<TResult>>();
|
||||
|
||||
ret.ThrowIfError();
|
||||
|
||||
return ret.Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<RootNamespace>VPNServer_JSONRPC_CodeGen</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Templates\cs_main.txt" />
|
||||
<None Remove="Templates\cs_proj.txt" />
|
||||
<None Remove="Templates\cs_sln.txt" />
|
||||
<None Remove="Templates\doc.txt" />
|
||||
<None Remove="Templates\md_html.html" />
|
||||
<None Remove="Templates\ts_rpc.txt" />
|
||||
<None Remove="Templates\ts_test.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Templates\cs_main.txt" />
|
||||
<EmbeddedResource Include="Templates\cs_proj.txt" />
|
||||
<EmbeddedResource Include="Templates\cs_sln.txt" />
|
||||
<EmbeddedResource Include="Templates\doc.txt" />
|
||||
<EmbeddedResource Include="Templates\md_html.html" />
|
||||
<EmbeddedResource Include="Templates\ts_rpc.txt" />
|
||||
<EmbeddedResource Include="Templates\ts_test.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Markdig" Version="0.15.4" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2041
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vpnserver-jsonrpc-codegen", "vpnserver-jsonrpc-codegen.csproj", "{00B41CF0-7AE9-4542-9970-77B312412535}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{00B41CF0-7AE9-4542-9970-77B312412535}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{00B41CF0-7AE9-4542-9970-77B312412535}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{00B41CF0-7AE9-4542-9970-77B312412535}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{00B41CF0-7AE9-4542-9970-77B312412535}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {EBB5B5A2-21A9-42A1-B4F4-7ED92CD8BBC1}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,4 +1,4 @@
|
||||
This document describes how to build SoftEtherVPN for Unix based Operating systems
|
||||
This document describes how to build SoftEtherVPN for UNIX based Operating systems
|
||||
|
||||
- [Requirements](#requirements)
|
||||
* [Install requirements on Centos/RedHat](#install-requirements-on-centosredhat)
|
||||
@ -9,6 +9,9 @@ This document describes how to build SoftEtherVPN for Unix based Operating syste
|
||||
* [Start/Stop SoftEther VPN Server](#startstop-softether-vpn-server)
|
||||
* [Start/Stop SoftEther VPN Bridge](#startstop-softether-vpn-bridge)
|
||||
* [Start/Stop SoftEther VPN Client](#startstop-softether-vpn-client)
|
||||
- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite)
|
||||
* [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console)
|
||||
* [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite)
|
||||
- [Using SoftEther without installation.](#using-softether-without-installation)
|
||||
|
||||
# Requirements
|
||||
@ -107,6 +110,8 @@ connect to the VPN Server remotely. You can download the GUI Tool
|
||||
from http://www.softether-download.com/.
|
||||
|
||||
|
||||
|
||||
|
||||
## Start/Stop SoftEther VPN Bridge
|
||||
|
||||
To start the SoftEther VPN Bridge background service, run the following:
|
||||
@ -159,7 +164,39 @@ connect to the VPN Client remotely. You can download the GUI Tool
|
||||
from http://www.softether-download.com/.
|
||||
|
||||
|
||||
# Using SoftEther without installation.
|
||||
# About HTML5-based Modern Admin Console and JSON-RPC API Suite
|
||||
|
||||
## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console
|
||||
We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server.
|
||||
|
||||
Access to the following URL from your favorite web browser.
|
||||
|
||||
```
|
||||
https://<vpn_server_hostname>:<port>/admin/
|
||||
```
|
||||
|
||||
For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by:
|
||||
|
||||
```
|
||||
https://192.168.0.1:5555/admin/
|
||||
```
|
||||
|
||||
Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server.
|
||||
|
||||
|
||||
## Built-in SoftEther Server VPN JSON-RPC API Suite
|
||||
The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions).
|
||||
|
||||
You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/)
|
||||
|
||||
- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API.
|
||||
You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.)
|
||||
- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server.
|
||||
- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment.
|
||||
- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available.
|
||||
|
||||
|
||||
# Using SoftEther without installation
|
||||
|
||||
You can use any SoftEtherVPN component (server, client, bridge) without installing it, if you wish so.
|
||||
|
||||
|
1408
src/Cedar/Admin.c
1408
src/Cedar/Admin.c
File diff suppressed because it is too large
Load Diff
@ -32,6 +32,8 @@ struct ADMIN
|
||||
LIST *LogFileList; // Accessible log file list
|
||||
UINT ClientBuild; // Build number of the client
|
||||
RPC_WINVER ClientWinVer; // Windows version of client
|
||||
UINT MaxJsonRpcRecvSize; // Max JSON-RPC Receive Size
|
||||
char dummy1[MAX_HUBNAME_LEN + 1]; // hubname buffer (dummy)
|
||||
};
|
||||
|
||||
// Test
|
||||
@ -118,7 +120,8 @@ struct RPC_INT
|
||||
// Set Password
|
||||
struct RPC_SET_PASSWORD
|
||||
{
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Hashed password
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Hashed password (for traditional RPC)
|
||||
char PlainTextPassword[MAX_SIZE]; // Plaintext password (for JSON-RPC)
|
||||
};
|
||||
|
||||
// Server farm configuration *
|
||||
@ -131,6 +134,7 @@ struct RPC_FARM
|
||||
char ControllerName[MAX_HOST_NAME_LEN + 1]; // Controller name
|
||||
UINT ControllerPort; // Controller port
|
||||
UCHAR MemberPassword[SHA1_SIZE]; // Member password
|
||||
char MemberPasswordPlaintext[MAX_SIZE]; // Member password (plaintext)
|
||||
UINT Weight; // Performance ratio
|
||||
bool ControllerOnly; // Only controller function
|
||||
};
|
||||
@ -236,6 +240,7 @@ struct RPC_CREATE_HUB
|
||||
char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name
|
||||
UCHAR HashedPassword[SHA1_SIZE]; // Administrative password
|
||||
UCHAR SecurePassword[SHA1_SIZE]; // Administrator password
|
||||
char AdminPasswordPlainText[MAX_SIZE]; // Password (plaintext)
|
||||
bool Online; // Online flag
|
||||
RPC_HUB_OPTION HubOption; // HUB options
|
||||
UINT HubType; // Type of HUB
|
||||
@ -553,6 +558,7 @@ struct RPC_ENUM_SESSION_ITEM
|
||||
char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote server name
|
||||
char Username[MAX_USERNAME_LEN + 1]; // User name
|
||||
UINT Ip; // IP address (IPv4)
|
||||
IP ClientIP; // IP address (IPv4 / IPv6)
|
||||
char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name
|
||||
UINT MaxNumTcp; // Maximum number of TCP connections
|
||||
UINT CurrentNumTcp; // Number of currentl TCP connections
|
||||
@ -569,6 +575,8 @@ struct RPC_ENUM_SESSION_ITEM
|
||||
bool IsDormantEnabled; // Is the dormant state enabled
|
||||
bool IsDormant; // Is in the dormant state
|
||||
UINT64 LastCommDormant; // Last comm interval in the dormant state
|
||||
UINT64 CreatedTime; // Creation date and time
|
||||
UINT64 LastCommTime; // Last communication date and time
|
||||
};
|
||||
|
||||
// Disconnect the session
|
||||
@ -605,8 +613,9 @@ struct RPC_ENUM_IP_TABLE_ITEM
|
||||
{
|
||||
UINT Key; // Key
|
||||
char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name
|
||||
UINT Ip; // IP address
|
||||
UINT Ip; // IPv4 address
|
||||
IP IpV6; // IPv6 address
|
||||
IP IpAddress; // IPv4 / IPv6 Address
|
||||
bool DhcpAllocated; // Assigned by the DHCP
|
||||
UINT64 CreatedTime; // Creation date and time
|
||||
UINT64 UpdatedTime; // Updating date
|
||||
@ -892,6 +901,10 @@ struct RPC_AZURE_STATUS
|
||||
bool IsConnected; // Whether it's connected
|
||||
};
|
||||
|
||||
// Constants
|
||||
#define ADMIN_RPC_MAX_POST_SIZE_BY_SERVER_ADMIN MAX_PACK_SIZE
|
||||
#define ADMIN_RPC_MAX_POST_SIZE_BY_HUB_ADMIN (8 * 1024 * 1024)
|
||||
|
||||
|
||||
// Function prototype
|
||||
UINT AdminAccept(CONNECTION *c, PACK *p);
|
||||
@ -916,6 +929,26 @@ BUF *DownloadFileFromServer(RPC *r, char *server_name, char *filepath, UINT tota
|
||||
bool CheckAdminSourceAddress(SOCK *sock, char *hubname);
|
||||
void SiEnumSessionMain(SERVER *s, RPC_ENUM_SESSION *t);
|
||||
bool SiIsEmptyPassword(void *hash_password);
|
||||
void JsonRpcProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size);
|
||||
void JsonRpcProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target);
|
||||
void JsonRpcProcOptions(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target);
|
||||
JSON_VALUE *JsonRpcProcRequestObject(ADMIN *admin, CONNECTION *c, SOCK *s, JSON_VALUE *json_req, char *method_name);
|
||||
JSON_VALUE *JsonRpcNewError(int code, wchar_t *message);
|
||||
JSON_VALUE *JsonRpcNewResponse(PACK *p);
|
||||
bool HttpParseBasicAuthHeader(HTTP_HEADER *h, char *username, UINT username_size, char *password, UINT password_size);
|
||||
ADMIN *JsonRpcAuthLogin(CEDAR *c, SOCK *sock, HTTP_HEADER *h);
|
||||
JSON_VALUE *QueryStringToJsonListValue(char *qs);
|
||||
JSON_VALUE *ConstructDummyJsonRpcRequest(char *method_name, JSON_VALUE *p);
|
||||
void AdminWebProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size, char *url_target);
|
||||
void AdminWebProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target);
|
||||
bool AdminWebHandleFileRequest(ADMIN *a, CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_src, char *query_string, char *virtual_root_dir, char *physical_root_dir);
|
||||
BUF *AdminWebProcessServerSideInclude(BUF *src_txt, char *filename, UINT depth);
|
||||
bool AdminWebSendBody(SOCK *s, UINT status_code, char *status_string, UCHAR *data, UINT data_size, char *content_type, char *add_header_name, char *add_header_value, HTTP_HEADER *request_headers);
|
||||
bool AdminWebSend404Error(SOCK *s, HTTP_HEADER *request_headers);
|
||||
bool AdminWebSend302Redirect(SOCK *s, char *url, char *query_string, HTTP_HEADER *request_headers);
|
||||
BUF *AdminWebTryFindAndReadFile(char *vroot, char *proot, char *url, char *ret_filename, UINT ret_filename_size, bool *is_index_html);
|
||||
BUF *AdminWebTryOneFile(char *filename, char *ret_filename, UINT ret_filename_size);
|
||||
bool AdminWebSendUnauthorized(SOCK *s, HTTP_HEADER *http_request_headers);
|
||||
|
||||
UINT StTest(ADMIN *a, RPC_TEST *t);
|
||||
UINT StGetServerInfo(ADMIN *a, RPC_SERVER_INFO *t);
|
||||
@ -1291,7 +1324,7 @@ void OutRpcAccess(PACK *p, ACCESS *a);
|
||||
void InRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a, PACK *p);
|
||||
void OutRpcEnumAccessList(PACK *p, RPC_ENUM_ACCESS_LIST *a);
|
||||
void FreeRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a);
|
||||
void *InRpcAuthData(PACK *p, UINT *authtype);
|
||||
void *InRpcAuthData(PACK *p, UINT *authtype, char *username);
|
||||
void OutRpcAuthData(PACK *p, void *authdata, UINT authtype);
|
||||
void FreeRpcAuthData(void *authdata, UINT authtype);
|
||||
void InRpcSetUser(RPC_SET_USER *t, PACK *p);
|
||||
|
@ -9578,8 +9578,9 @@ void CmPrintStatusToListViewEx(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool
|
||||
|
||||
GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->StartTime), NULL);
|
||||
LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_START_TIME"), tmp);
|
||||
GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->FirstConnectionEstablishedTime), NULL);
|
||||
LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_FIRST_ESTAB_TIME"), s->FirstConnectionEstablishedTime == 0 ? _UU("CM_ST_NONE") : tmp);
|
||||
GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->FirstConnectionEstablisiedTime), NULL);
|
||||
/* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_FIRST_ESTAB_TIME"), s->FirstConnectionEstablisiedTime == 0 ? _UU("CM_ST_NONE") : tmp);
|
||||
|
||||
if (s->Connected)
|
||||
{
|
||||
|
@ -137,6 +137,7 @@ typedef struct BLACK BLACK;
|
||||
typedef struct SEND_SIGNATURE_PARAM SEND_SIGNATURE_PARAM;
|
||||
typedef struct UPDATE_CLIENT UPDATE_CLIENT;
|
||||
typedef struct UPDATE_CLIENT_SETTING UPDATE_CLIENT_SETTING;
|
||||
typedef struct HTTP_MIME_TYPE HTTP_MIME_TYPE;
|
||||
|
||||
|
||||
// ==============================================================
|
||||
|
@ -3810,14 +3810,16 @@ void OutRpcClientEnumCa(PACK *p, RPC_CLIENT_ENUM_CA *e)
|
||||
|
||||
PackAddNum(p, "NumItem", e->NumItem);
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "CAList");
|
||||
for (i = 0;i < e->NumItem;i++)
|
||||
{
|
||||
RPC_CLIENT_ENUM_CA_ITEM *item = e->Items[i];
|
||||
PackAddIntEx(p, "Key", item->Key, i, e->NumItem);
|
||||
PackAddUniStrEx(p, "SubjectName", item->SubjectName, i, e->NumItem);
|
||||
PackAddUniStrEx(p, "IssuerName", item->IssuerName, i, e->NumItem);
|
||||
PackAddInt64Ex(p, "Expires", item->Expires, i, e->NumItem);
|
||||
PackAddTime64Ex(p, "Expires", item->Expires, i, e->NumItem);
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
}
|
||||
|
||||
// RPC_GET_ISSUER
|
||||
@ -4088,6 +4090,7 @@ void OutRpcClientEnumSecure(PACK *p, RPC_CLIENT_ENUM_SECURE *e)
|
||||
|
||||
PackAddNum(p, "NumItem", e->NumItem);
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "SecureDeviceList");
|
||||
for (i = 0;i < e->NumItem;i++)
|
||||
{
|
||||
RPC_CLIENT_ENUM_SECURE_ITEM *item = e->Items[i];
|
||||
@ -4097,6 +4100,7 @@ void OutRpcClientEnumSecure(PACK *p, RPC_CLIENT_ENUM_SECURE *e)
|
||||
PackAddStrEx(p, "DeviceName", item->DeviceName, i, e->NumItem);
|
||||
PackAddStrEx(p, "Manufacturer", item->Manufacturer, i, e->NumItem);
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
}
|
||||
|
||||
// RPC_USE_SECURE
|
||||
@ -4153,11 +4157,13 @@ void OutRpcEnumObjectInSecure(PACK *p, RPC_ENUM_OBJECT_IN_SECURE *e)
|
||||
PackAddNum(p, "NumItem", e->NumItem);
|
||||
PackAddInt(p, "hWnd", e->hWnd);
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "ObjectList");
|
||||
for (i = 0;i < e->NumItem;i++)
|
||||
{
|
||||
PackAddStrEx(p, "ItemName", e->ItemName[i], i, e->NumItem);
|
||||
PackAddIntEx(p, "ItemType", e->ItemType[i], i, e->NumItem);
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
}
|
||||
|
||||
// RPC_CLIENT_CREATE_VLAN
|
||||
@ -4277,6 +4283,7 @@ void OutRpcClientEnumVLan(PACK *p, RPC_CLIENT_ENUM_VLAN *v)
|
||||
|
||||
PackAddNum(p, "NumItem", v->NumItem);
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "VLanList");
|
||||
for (i = 0;i < v->NumItem;i++)
|
||||
{
|
||||
RPC_CLIENT_ENUM_VLAN_ITEM *item = v->Items[i];
|
||||
@ -4286,6 +4293,7 @@ void OutRpcClientEnumVLan(PACK *p, RPC_CLIENT_ENUM_VLAN *v)
|
||||
PackAddStrEx(p, "MacAddress", item->MacAddress, i, v->NumItem);
|
||||
PackAddStrEx(p, "Version", item->Version, i, v->NumItem);
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
}
|
||||
|
||||
// CLIENT_OPTION
|
||||
@ -4352,10 +4360,10 @@ void OutRpcClientOption(PACK *p, CLIENT_OPTION *c)
|
||||
PackAddInt(p, "NumRetry", c->NumRetry);
|
||||
PackAddInt(p, "RetryInterval", c->RetryInterval);
|
||||
PackAddInt(p, "MaxConnection", c->MaxConnection);
|
||||
PackAddInt(p, "UseEncrypt", c->UseEncrypt);
|
||||
PackAddInt(p, "UseCompress", c->UseCompress);
|
||||
PackAddInt(p, "HalfConnection", c->HalfConnection);
|
||||
PackAddInt(p, "NoRoutingTracking", c->NoRoutingTracking);
|
||||
PackAddBool(p, "UseEncrypt", c->UseEncrypt);
|
||||
PackAddBool(p, "UseCompress", c->UseCompress);
|
||||
PackAddBool(p, "HalfConnection", c->HalfConnection);
|
||||
PackAddBool(p, "NoRoutingTracking", c->NoRoutingTracking);
|
||||
PackAddInt(p, "AdditionalConnectionInterval", c->AdditionalConnectionInterval);
|
||||
PackAddInt(p, "ConnectionDisconnectSpan", c->ConnectionDisconnectSpan);
|
||||
PackAddBool(p, "HideStatusWindow", c->HideStatusWindow);
|
||||
@ -4568,6 +4576,7 @@ void OutRpcClientEnumAccount(PACK *p, RPC_CLIENT_ENUM_ACCOUNT *e)
|
||||
|
||||
PackAddNum(p, "NumItem", e->NumItem);
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "AccountList");
|
||||
for (i = 0;i < e->NumItem;i++)
|
||||
{
|
||||
RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = e->Items[i];
|
||||
@ -4583,10 +4592,11 @@ void OutRpcClientEnumAccount(PACK *p, RPC_CLIENT_ENUM_ACCOUNT *e)
|
||||
PackAddBoolEx(p, "Connected", item->Connected, i, e->NumItem);
|
||||
PackAddIntEx(p, "Port", item->Port, i, e->NumItem);
|
||||
PackAddStrEx(p, "HubName", item->HubName, i, e->NumItem);
|
||||
PackAddInt64Ex(p, "CreateDateTime", item->CreateDateTime, i, e->NumItem);
|
||||
PackAddInt64Ex(p, "UpdateDateTime", item->UpdateDateTime, i, e->NumItem);
|
||||
PackAddInt64Ex(p, "LastConnectDateTime", item->LastConnectDateTime, i, e->NumItem);
|
||||
PackAddTime64Ex(p, "CreateDateTime", item->CreateDateTime, i, e->NumItem);
|
||||
PackAddTime64Ex(p, "UpdateDateTime", item->UpdateDateTime, i, e->NumItem);
|
||||
PackAddTime64Ex(p, "LastConnectDateTime", item->LastConnectDateTime, i, e->NumItem);
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
}
|
||||
|
||||
// RPC_CLIENT_DELETE_ACCOUNT
|
||||
@ -4702,9 +4712,9 @@ void OutRpcClientGetAccount(PACK *p, RPC_CLIENT_GET_ACCOUNT *c)
|
||||
|
||||
PackAddData(p, "ShortcutKey", c->ShortcutKey, SHA1_SIZE);
|
||||
|
||||
PackAddInt64(p, "CreateDateTime", c->CreateDateTime);
|
||||
PackAddInt64(p, "UpdateDateTime", c->UpdateDateTime);
|
||||
PackAddInt64(p, "LastConnectDateTime", c->LastConnectDateTime);
|
||||
PackAddTime64(p, "CreateDateTime", c->CreateDateTime);
|
||||
PackAddTime64(p, "UpdateDateTime", c->UpdateDateTime);
|
||||
PackAddTime64(p, "LastConnectDateTime", c->LastConnectDateTime);
|
||||
}
|
||||
|
||||
// RPC_CLIENT_CONNECT
|
||||
@ -4792,7 +4802,8 @@ void InRpcClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *s, PACK *p
|
||||
s->NumTcpConnectionsDownload = PackGetInt(p, "NumTcpConnectionsDownload");
|
||||
|
||||
s->StartTime = PackGetInt64(p, "StartTime");
|
||||
s->FirstConnectionEstablishedTime = PackGetInt64(p, "FirstConnectionEstablishedTime");
|
||||
/* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
s->FirstConnectionEstablisiedTime = PackGetInt64(p, "FirstConnectionEstablisiedTime");
|
||||
s->CurrentConnectionEstablishTime = PackGetInt64(p, "CurrentConnectionEstablishTime");
|
||||
s->TotalSendSize = PackGetInt64(p, "TotalSendSize");
|
||||
s->TotalRecvSize = PackGetInt64(p, "TotalRecvSize");
|
||||
@ -4852,32 +4863,32 @@ void OutRpcClientGetConnectionStatus(PACK *p, RPC_CLIENT_GET_CONNECTION_STATUS *
|
||||
|
||||
PackAddData(p, "SessionKey", c->SessionKey, SHA1_SIZE);
|
||||
|
||||
PackAddInt(p, "Active", c->Active);
|
||||
PackAddInt(p, "Connected", c->Connected);
|
||||
PackAddBool(p, "Active", c->Active);
|
||||
PackAddBool(p, "Connected", c->Connected);
|
||||
PackAddInt(p, "SessionStatus", c->SessionStatus);
|
||||
PackAddInt(p, "ServerPort", c->ServerPort);
|
||||
PackAddInt(p, "ServerProductVer", c->ServerProductVer);
|
||||
PackAddInt(p, "ServerProductBuild", c->ServerProductBuild);
|
||||
PackAddInt(p, "NumConnectionsEstablished", c->NumConnectionsEstablished);
|
||||
PackAddInt(p, "HalfConnection", c->HalfConnection);
|
||||
PackAddInt(p, "QoS", c->QoS);
|
||||
PackAddBool(p, "HalfConnection", c->HalfConnection);
|
||||
PackAddBool(p, "QoS", c->QoS);
|
||||
PackAddInt(p, "MaxTcpConnections", c->MaxTcpConnections);
|
||||
PackAddInt(p, "NumTcpConnections", c->NumTcpConnections);
|
||||
PackAddInt(p, "NumTcpConnectionsUpload", c->NumTcpConnectionsUpload);
|
||||
PackAddInt(p, "NumTcpConnectionsDownload", c->NumTcpConnectionsDownload);
|
||||
PackAddInt(p, "UseEncrypt", c->UseEncrypt);
|
||||
PackAddInt(p, "UseCompress", c->UseCompress);
|
||||
PackAddInt(p, "IsRUDPSession", c->IsRUDPSession);
|
||||
PackAddBool(p, "UseEncrypt", c->UseEncrypt);
|
||||
PackAddBool(p, "UseCompress", c->UseCompress);
|
||||
PackAddBool(p, "IsRUDPSession", c->IsRUDPSession);
|
||||
PackAddStr(p, "UnderlayProtocol", c->UnderlayProtocol);
|
||||
PackAddInt(p, "IsUdpAccelerationEnabled", c->IsUdpAccelerationEnabled);
|
||||
PackAddInt(p, "IsUsingUdpAcceleration", c->IsUsingUdpAcceleration);
|
||||
PackAddBool(p, "IsUdpAccelerationEnabled", c->IsUdpAccelerationEnabled);
|
||||
PackAddBool(p, "IsUsingUdpAcceleration", c->IsUsingUdpAcceleration);
|
||||
|
||||
PackAddBool(p, "IsBridgeMode", c->IsBridgeMode);
|
||||
PackAddBool(p, "IsMonitorMode", c->IsMonitorMode);
|
||||
|
||||
PackAddInt64(p, "StartTime", c->StartTime);
|
||||
PackAddInt64(p, "FirstConnectionEstablishedTime", c->FirstConnectionEstablishedTime);
|
||||
PackAddInt64(p, "CurrentConnectionEstablishTime", c->CurrentConnectionEstablishTime);
|
||||
PackAddTime64(p, "StartTime", c->StartTime);
|
||||
PackAddTime64(p, "FirstConnectionEstablisiedTime", c->FirstConnectionEstablisiedTime);
|
||||
PackAddTime64(p, "CurrentConnectionEstablishTime", c->CurrentConnectionEstablishTime);
|
||||
PackAddInt64(p, "TotalSendSize", c->TotalSendSize);
|
||||
PackAddInt64(p, "TotalRecvSize", c->TotalRecvSize);
|
||||
PackAddInt64(p, "TotalSendSizeReal", c->TotalSendSizeReal);
|
||||
@ -5852,7 +5863,8 @@ void CiGetSessionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st, SESSION *s)
|
||||
// Connection start time
|
||||
st->StartTime = TickToTime(s->CreatedTime);
|
||||
// Connection completion time of the first connection
|
||||
st->FirstConnectionEstablishedTime = TickToTime(s->FirstConnectionEstablishedTime);
|
||||
/* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
st->FirstConnectionEstablisiedTime = TickToTime(s->FirstConnectionEstablisiedTime);
|
||||
// Number of connections have been established so far
|
||||
st->NumConnectionsEstablished = s->NumConnectionsEstablished;
|
||||
}
|
||||
|
@ -325,7 +325,8 @@ struct RPC_CLIENT_GET_CONNECTION_STATUS
|
||||
X *ServerX; // Server certificate
|
||||
X *ClientX; // Client certificate
|
||||
UINT64 StartTime; // Connection start time
|
||||
UINT64 FirstConnectionEstablishedTime; // Connection completion time of the first connection
|
||||
/* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
UINT64 FirstConnectionEstablisiedTime; // Connection completion time of the first connection
|
||||
UINT64 CurrentConnectionEstablishTime; // Connection completion time of this connection
|
||||
UINT NumConnectionsEstablished; // Number of connections have been established so far
|
||||
bool HalfConnection; // Half-connection
|
||||
|
@ -15077,8 +15077,10 @@ void CmdPrintStatusToListViewEx(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s, boo
|
||||
|
||||
GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->StartTime), NULL);
|
||||
CtInsert(ct, _UU("CM_ST_START_TIME"), tmp);
|
||||
GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->FirstConnectionEstablishedTime), NULL);
|
||||
CtInsert(ct, _UU("CM_ST_FIRST_ESTAB_TIME"), s->FirstConnectionEstablishedTime == 0 ? _UU("CM_ST_NONE") : tmp);
|
||||
/* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->FirstConnectionEstablisiedTime), NULL);
|
||||
/* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
CtInsert(ct, _UU("CM_ST_FIRST_ESTAB_TIME"), s->FirstConnectionEstablisiedTime == 0 ? _UU("CM_ST_NONE") : tmp);
|
||||
|
||||
if (s->Connected)
|
||||
{
|
||||
|
@ -216,6 +216,9 @@ struct CONNECTION
|
||||
UINT LastPacketQueueSize; // The last queue size of packets
|
||||
UINT LastRecvFifoTotalSize; // The last RecvFifo total size
|
||||
UINT LastRecvBlocksNum; // The last ReceivedBlocks num
|
||||
bool IsJsonRpc; // Is JSON-RPC
|
||||
bool JsonRpcAuthed; // JSON-RPC Authed
|
||||
LISTENER *Listener; // Listener ref
|
||||
};
|
||||
|
||||
|
||||
|
@ -37,6 +37,9 @@ void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st)
|
||||
Copy(&st->InternetSetting, &c->InternetSetting, sizeof(INTERNET_SETTING));
|
||||
}
|
||||
Unlock(c->Lock);
|
||||
|
||||
UniStrCpy(st->ErrStr_IPv4, sizeof(st->ErrStr_IPv4), _E(st->Err_IPv4));
|
||||
UniStrCpy(st->ErrStr_IPv6, sizeof(st->ErrStr_IPv6), _E(st->Err_IPv6));
|
||||
}
|
||||
|
||||
// Set the Internet settings
|
||||
|
@ -111,6 +111,8 @@ struct DDNS_REGISTER_PARAM
|
||||
struct DDNS_CLIENT_STATUS
|
||||
{
|
||||
UINT Err_IPv4, Err_IPv6; // Last error
|
||||
wchar_t ErrStr_IPv4[MAX_SIZE];
|
||||
wchar_t ErrStr_IPv6[MAX_SIZE];
|
||||
char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name
|
||||
char CurrentFqdn[MAX_SIZE]; // Current FQDN
|
||||
char DnsSuffix[MAX_SIZE]; // DNS suffix
|
||||
|
@ -558,6 +558,7 @@ void OutRpcEnumDevice(PACK *p, RPC_ENUM_DEVICE *t)
|
||||
|
||||
PackAddInt(p, "NumItem", t->NumItem);
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "DeviceList");
|
||||
for (i = 0;i < t->NumItem;i++)
|
||||
{
|
||||
RPC_ENUM_DEVICE_ITEM *d = &t->Items[i];
|
||||
@ -565,6 +566,7 @@ void OutRpcEnumDevice(PACK *p, RPC_ENUM_DEVICE *t)
|
||||
PackAddStrEx(p, "DeviceName", d->DeviceName, i, t->NumItem);
|
||||
PackAddBoolEx(p, "Active", d->Active, i, t->NumItem);
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
|
||||
PackAddBool(p, "IsLicenseSupported", t->IsLicenseSupported);
|
||||
}
|
||||
@ -605,7 +607,7 @@ void OutRpcElLicenseStatus(PACK *p, RPC_EL_LICENSE_STATUS *t)
|
||||
|
||||
PackAddBool(p, "Valid", t->Valid);
|
||||
PackAddInt64(p, "SystemId", t->SystemId);
|
||||
PackAddInt64(p, "SystemExpires", t->SystemExpires);
|
||||
PackAddTime64(p, "SystemExpires", t->SystemExpires);
|
||||
}
|
||||
|
||||
// Listener thread
|
||||
|
@ -681,6 +681,8 @@ void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name)
|
||||
{
|
||||
ADMIN_OPTION *a = LIST_DATA(aol, i);
|
||||
|
||||
UniStrCpy(a->Descrption, sizeof(a->Descrption), GetHubAdminOptionHelpString(a->Name));
|
||||
|
||||
Copy(&ao->Items[i], a, sizeof(ADMIN_OPTION));
|
||||
|
||||
Free(a);
|
||||
|
@ -287,6 +287,7 @@ struct ADMIN_OPTION
|
||||
{
|
||||
char Name[MAX_ADMIN_OPTION_NAME_LEN + 1]; // Name
|
||||
UINT Value; // Data
|
||||
wchar_t Descrption[MAX_SIZE]; // Descrption
|
||||
};
|
||||
|
||||
// Certificate Revocation List entry
|
||||
|
@ -150,6 +150,9 @@ void TCPAcceptedThread(THREAD *t, void *param)
|
||||
// Create a connection
|
||||
c = NewServerConnection(r->Cedar, s, t);
|
||||
|
||||
AddRef(r->ref);
|
||||
c->Listener = r;
|
||||
|
||||
// Register to Cedar as a transient connection
|
||||
AddConnection(c->Cedar, c);
|
||||
|
||||
@ -169,6 +172,8 @@ void TCPAcceptedThread(THREAD *t, void *param)
|
||||
|
||||
// Release
|
||||
SLog(r->Cedar, "LS_CONNECTION_END_1", c->Name);
|
||||
ReleaseListener(c->Listener);
|
||||
c->Listener = NULL;
|
||||
ReleaseConnection(c);
|
||||
|
||||
// Release
|
||||
|
@ -797,18 +797,20 @@ void OutRpcEnumDhcp(PACK *p, RPC_ENUM_DHCP *t)
|
||||
PackAddInt(p, "NumItem", t->NumItem);
|
||||
PackAddStr(p, "HubName", t->HubName);
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "DhcpTable");
|
||||
for (i = 0;i < t->NumItem;i++)
|
||||
{
|
||||
RPC_ENUM_DHCP_ITEM *e = &t->Items[i];
|
||||
|
||||
PackAddIntEx(p, "Id", e->Id, i, t->NumItem);
|
||||
PackAddInt64Ex(p, "LeasedTime", e->LeasedTime, i, t->NumItem);
|
||||
PackAddInt64Ex(p, "ExpireTime", e->ExpireTime, i, t->NumItem);
|
||||
PackAddTime64Ex(p, "LeasedTime", e->LeasedTime, i, t->NumItem);
|
||||
PackAddTime64Ex(p, "ExpireTime", e->ExpireTime, i, t->NumItem);
|
||||
PackAddDataEx(p, "MacAddress", e->MacAddress, 6, i, t->NumItem);
|
||||
PackAddIp32Ex(p, "IpAddress", e->IpAddress, i, t->NumItem);
|
||||
PackAddIntEx(p, "Mask", e->Mask, i, t->NumItem);
|
||||
PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumItem);
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
}
|
||||
void FreeRpcEnumDhcp(RPC_ENUM_DHCP *t)
|
||||
{
|
||||
@ -865,6 +867,8 @@ void OutRpcEnumNat(PACK *p, RPC_ENUM_NAT *t)
|
||||
|
||||
PackAddInt(p, "NumItem", t->NumItem);
|
||||
PackAddStr(p, "HubName", t->HubName);
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "NatTable");
|
||||
for (i = 0;i < t->NumItem;i++)
|
||||
{
|
||||
RPC_ENUM_NAT_ITEM *e = &t->Items[i];
|
||||
@ -877,12 +881,13 @@ void OutRpcEnumNat(PACK *p, RPC_ENUM_NAT *t)
|
||||
PackAddIp32Ex(p, "DestIp", e->DestIp, i, t->NumItem);
|
||||
PackAddStrEx(p, "DestHost", e->DestHost, i, t->NumItem);
|
||||
PackAddIntEx(p, "DestPort", e->DestPort, i, t->NumItem);
|
||||
PackAddInt64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumItem);
|
||||
PackAddInt64Ex(p, "LastCommTime", e->LastCommTime, i, t->NumItem);
|
||||
PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumItem);
|
||||
PackAddTime64Ex(p, "LastCommTime", e->LastCommTime, i, t->NumItem);
|
||||
PackAddInt64Ex(p, "SendSize", e->SendSize, i, t->NumItem);
|
||||
PackAddInt64Ex(p, "RecvSize", e->RecvSize, i, t->NumItem);
|
||||
PackAddIntEx(p, "TcpStatus", e->TcpStatus, i, t->NumItem);
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
}
|
||||
void FreeRpcEnumNat(RPC_ENUM_NAT *t)
|
||||
{
|
||||
|
@ -9,6 +9,726 @@
|
||||
|
||||
static UCHAR ssl_packet_start[3] = {0x17, 0x03, 0x00};
|
||||
|
||||
// MIME list from https://www.freeformatter.com/mime-types-list.html
|
||||
static HTTP_MIME_TYPE http_mime_types[] =
|
||||
{
|
||||
{".x3d", "application/vnd.hzn-3d-crossword"},
|
||||
{".3gp", "video/3gpp"},
|
||||
{".3g2", "video/3gpp2"},
|
||||
{".mseq", "application/vnd.mseq"},
|
||||
{".pwn", "application/vnd.3m.post-it-notes"},
|
||||
{".plb", "application/vnd.3gpp.pic-bw-large"},
|
||||
{".psb", "application/vnd.3gpp.pic-bw-small"},
|
||||
{".pvb", "application/vnd.3gpp.pic-bw-var"},
|
||||
{".tcap", "application/vnd.3gpp2.tcap"},
|
||||
{".7z", "application/x-7z-compressed"},
|
||||
{".abw", "application/x-abiword"},
|
||||
{".ace", "application/x-ace-compressed"},
|
||||
{".acc", "application/vnd.americandynamics.acc"},
|
||||
{".acu", "application/vnd.acucobol"},
|
||||
{".atc", "application/vnd.acucorp"},
|
||||
{".adp", "audio/adpcm"},
|
||||
{".aab", "application/x-authorware-bin"},
|
||||
{".aam", "application/x-authorware-map"},
|
||||
{".aas", "application/x-authorware-seg"},
|
||||
{".air", "application/vnd.adobe.air-application-installer-package+zip"},
|
||||
{".swf", "application/x-shockwave-flash"},
|
||||
{".fxp", "application/vnd.adobe.fxp"},
|
||||
{".pdf", "application/pdf"},
|
||||
{".ppd", "application/vnd.cups-ppd"},
|
||||
{".dir", "application/x-director"},
|
||||
{".xdp", "application/vnd.adobe.xdp+xml"},
|
||||
{".xfdf", "application/vnd.adobe.xfdf"},
|
||||
{".aac", "audio/x-aac"},
|
||||
{".ahead", "application/vnd.ahead.space"},
|
||||
{".azf", "application/vnd.airzip.filesecure.azf"},
|
||||
{".azs", "application/vnd.airzip.filesecure.azs"},
|
||||
{".azw", "application/vnd.amazon.ebook"},
|
||||
{".ami", "application/vnd.amiga.ami"},
|
||||
{".apk", "application/vnd.android.package-archive"},
|
||||
{".cii", "application/vnd.anser-web-certificate-issue-initiation"},
|
||||
{".fti", "application/vnd.anser-web-funds-transfer-initiation"},
|
||||
{".atx", "application/vnd.antix.game-component"},
|
||||
{".dmg", "application/x-apple-diskimage"},
|
||||
{".mpkg", "application/vnd.apple.installer+xml"},
|
||||
{".aw", "application/applixware"},
|
||||
{".les", "application/vnd.hhe.lesson-player"},
|
||||
{".swi", "application/vnd.aristanetworks.swi"},
|
||||
{".s", "text/x-asm"},
|
||||
{".atomcat", "application/atomcat+xml"},
|
||||
{".atomsvc", "application/atomsvc+xml"},
|
||||
{".atom", "application/atom+xml"},
|
||||
{".ac", "application/pkix-attr-cert"},
|
||||
{".aif", "audio/x-aiff"},
|
||||
{".avi", "video/x-msvideo"},
|
||||
{".aep", "application/vnd.audiograph"},
|
||||
{".dxf", "image/vnd.dxf"},
|
||||
{".dwf", "model/vnd.dwf"},
|
||||
{".par", "text/plain-bas"},
|
||||
{".bcpio", "application/x-bcpio"},
|
||||
{".bin", "application/octet-stream"},
|
||||
{".bmp", "image/bmp"},
|
||||
{".torrent", "application/x-bittorrent"},
|
||||
{".cod", "application/vnd.rim.cod"},
|
||||
{".mpm", "application/vnd.blueice.multipass"},
|
||||
{".bmi", "application/vnd.bmi"},
|
||||
{".sh", "application/x-sh"},
|
||||
{".btif", "image/prs.btif"},
|
||||
{".rep", "application/vnd.businessobjects"},
|
||||
{".bz", "application/x-bzip"},
|
||||
{".bz2", "application/x-bzip2"},
|
||||
{".csh", "application/x-csh"},
|
||||
{".c", "text/x-c"},
|
||||
{".cdxml", "application/vnd.chemdraw+xml"},
|
||||
{".css", "text/css"},
|
||||
{".cdx", "chemical/x-cdx"},
|
||||
{".cml", "chemical/x-cml"},
|
||||
{".csml", "chemical/x-csml"},
|
||||
{".cdbcmsg", "application/vnd.contact.cmsg"},
|
||||
{".cla", "application/vnd.claymore"},
|
||||
{".c4g", "application/vnd.clonk.c4group"},
|
||||
{".sub", "image/vnd.dvb.subtitle"},
|
||||
{".cdmia", "application/cdmi-capability"},
|
||||
{".cdmic", "application/cdmi-container"},
|
||||
{".cdmid", "application/cdmi-domain"},
|
||||
{".cdmio", "application/cdmi-object"},
|
||||
{".cdmiq", "application/cdmi-queue"},
|
||||
{".c11amc", "application/vnd.cluetrust.cartomobile-config"},
|
||||
{".c11amz", "application/vnd.cluetrust.cartomobile-config-pkg"},
|
||||
{".ras", "image/x-cmu-raster"},
|
||||
{".dae", "model/vnd.collada+xml"},
|
||||
{".csv", "text/csv"},
|
||||
{".cpt", "application/mac-compactpro"},
|
||||
{".wmlc", "application/vnd.wap.wmlc"},
|
||||
{".cgm", "image/cgm"},
|
||||
{".ice", "x-conference/x-cooltalk"},
|
||||
{".cmx", "image/x-cmx"},
|
||||
{".xar", "application/vnd.xara"},
|
||||
{".cmc", "application/vnd.cosmocaller"},
|
||||
{".cpio", "application/x-cpio"},
|
||||
{".clkx", "application/vnd.crick.clicker"},
|
||||
{".clkk", "application/vnd.crick.clicker.keyboard"},
|
||||
{".clkp", "application/vnd.crick.clicker.palette"},
|
||||
{".clkt", "application/vnd.crick.clicker.template"},
|
||||
{".clkw", "application/vnd.crick.clicker.wordbank"},
|
||||
{".wbs", "application/vnd.criticaltools.wbs+xml"},
|
||||
{".cryptonote", "application/vnd.rig.cryptonote"},
|
||||
{".cif", "chemical/x-cif"},
|
||||
{".cmdf", "chemical/x-cmdf"},
|
||||
{".cu", "application/cu-seeme"},
|
||||
{".cww", "application/prs.cww"},
|
||||
{".curl", "text/vnd.curl"},
|
||||
{".dcurl", "text/vnd.curl.dcurl"},
|
||||
{".mcurl", "text/vnd.curl.mcurl"},
|
||||
{".scurl", "text/vnd.curl.scurl"},
|
||||
{".car", "application/vnd.curl.car"},
|
||||
{".pcurl", "application/vnd.curl.pcurl"},
|
||||
{".cmp", "application/vnd.yellowriver-custom-menu"},
|
||||
{".dssc", "application/dssc+der"},
|
||||
{".xdssc", "application/dssc+xml"},
|
||||
{".deb", "application/x-debian-package"},
|
||||
{".uva", "audio/vnd.dece.audio"},
|
||||
{".uvi", "image/vnd.dece.graphic"},
|
||||
{".uvh", "video/vnd.dece.hd"},
|
||||
{".uvm", "video/vnd.dece.mobile"},
|
||||
{".uvu", "video/vnd.uvvu.mp4"},
|
||||
{".uvp", "video/vnd.dece.pd"},
|
||||
{".uvs", "video/vnd.dece.sd"},
|
||||
{".uvv", "video/vnd.dece.video"},
|
||||
{".dvi", "application/x-dvi"},
|
||||
{".seed", "application/vnd.fdsn.seed"},
|
||||
{".dtb", "application/x-dtbook+xml"},
|
||||
{".res", "application/x-dtbresource+xml"},
|
||||
{".ait", "application/vnd.dvb.ait"},
|
||||
{".svc", "application/vnd.dvb.service"},
|
||||
{".eol", "audio/vnd.digital-winds"},
|
||||
{".djvu", "image/vnd.djvu"},
|
||||
{".dtd", "application/xml-dtd"},
|
||||
{".mlp", "application/vnd.dolby.mlp"},
|
||||
{".wad", "application/x-doom"},
|
||||
{".dpg", "application/vnd.dpgraph"},
|
||||
{".dra", "audio/vnd.dra"},
|
||||
{".dfac", "application/vnd.dreamfactory"},
|
||||
{".dts", "audio/vnd.dts"},
|
||||
{".dtshd", "audio/vnd.dts.hd"},
|
||||
{".dwg", "image/vnd.dwg"},
|
||||
{".geo", "application/vnd.dynageo"},
|
||||
{".es", "application/ecmascript"},
|
||||
{".mag", "application/vnd.ecowin.chart"},
|
||||
{".mmr", "image/vnd.fujixerox.edmics-mmr"},
|
||||
{".rlc", "image/vnd.fujixerox.edmics-rlc"},
|
||||
{".exi", "application/exi"},
|
||||
{".mgz", "application/vnd.proteus.magazine"},
|
||||
{".epub", "application/epub+zip"},
|
||||
{".eml", "message/rfc822"},
|
||||
{".nml", "application/vnd.enliven"},
|
||||
{".xpr", "application/vnd.is-xpr"},
|
||||
{".xif", "image/vnd.xiff"},
|
||||
{".xfdl", "application/vnd.xfdl"},
|
||||
{".emma", "application/emma+xml"},
|
||||
{".ez2", "application/vnd.ezpix-album"},
|
||||
{".ez3", "application/vnd.ezpix-package"},
|
||||
{".fst", "image/vnd.fst"},
|
||||
{".fvt", "video/vnd.fvt"},
|
||||
{".fbs", "image/vnd.fastbidsheet"},
|
||||
{".fe_launch", "application/vnd.denovo.fcselayout-link"},
|
||||
{".f4v", "video/x-f4v"},
|
||||
{".flv", "video/x-flv"},
|
||||
{".fpx", "image/vnd.fpx"},
|
||||
{".npx", "image/vnd.net-fpx"},
|
||||
{".flx", "text/vnd.fmi.flexstor"},
|
||||
{".fli", "video/x-fli"},
|
||||
{".ftc", "application/vnd.fluxtime.clip"},
|
||||
{".fdf", "application/vnd.fdf"},
|
||||
{".f", "text/x-fortran"},
|
||||
{".mif", "application/vnd.mif"},
|
||||
{".fm", "application/vnd.framemaker"},
|
||||
{".fh", "image/x-freehand"},
|
||||
{".fsc", "application/vnd.fsc.weblaunch"},
|
||||
{".fnc", "application/vnd.frogans.fnc"},
|
||||
{".ltf", "application/vnd.frogans.ltf"},
|
||||
{".ddd", "application/vnd.fujixerox.ddd"},
|
||||
{".xdw", "application/vnd.fujixerox.docuworks"},
|
||||
{".xbd", "application/vnd.fujixerox.docuworks.binder"},
|
||||
{".oas", "application/vnd.fujitsu.oasys"},
|
||||
{".oa2", "application/vnd.fujitsu.oasys2"},
|
||||
{".oa3", "application/vnd.fujitsu.oasys3"},
|
||||
{".fg5", "application/vnd.fujitsu.oasysgp"},
|
||||
{".bh2", "application/vnd.fujitsu.oasysprs"},
|
||||
{".spl", "application/x-futuresplash"},
|
||||
{".fzs", "application/vnd.fuzzysheet"},
|
||||
{".g3", "image/g3fax"},
|
||||
{".gmx", "application/vnd.gmx"},
|
||||
{".gtw", "model/vnd.gtw"},
|
||||
{".txd", "application/vnd.genomatix.tuxedo"},
|
||||
{".ggb", "application/vnd.geogebra.file"},
|
||||
{".ggt", "application/vnd.geogebra.tool"},
|
||||
{".gdl", "model/vnd.gdl"},
|
||||
{".gex", "application/vnd.geometry-explorer"},
|
||||
{".gxt", "application/vnd.geonext"},
|
||||
{".g2w", "application/vnd.geoplan"},
|
||||
{".g3w", "application/vnd.geospace"},
|
||||
{".gsf", "application/x-font-ghostscript"},
|
||||
{".bdf", "application/x-font-bdf"},
|
||||
{".gtar", "application/x-gtar"},
|
||||
{".texinfo", "application/x-texinfo"},
|
||||
{".gnumeric", "application/x-gnumeric"},
|
||||
{".kml", "application/vnd.google-earth.kml+xml"},
|
||||
{".kmz", "application/vnd.google-earth.kmz"},
|
||||
{".gqf", "application/vnd.grafeq"},
|
||||
{".gif", "image/gif"},
|
||||
{".gv", "text/vnd.graphviz"},
|
||||
{".gac", "application/vnd.groove-account"},
|
||||
{".ghf", "application/vnd.groove-help"},
|
||||
{".gim", "application/vnd.groove-identity-message"},
|
||||
{".grv", "application/vnd.groove-injector"},
|
||||
{".gtm", "application/vnd.groove-tool-message"},
|
||||
{".tpl", "application/vnd.groove-tool-template"},
|
||||
{".vcg", "application/vnd.groove-vcard"},
|
||||
{".h261", "video/h261"},
|
||||
{".h263", "video/h263"},
|
||||
{".h264", "video/h264"},
|
||||
{".hpid", "application/vnd.hp-hpid"},
|
||||
{".hps", "application/vnd.hp-hps"},
|
||||
{".hdf", "application/x-hdf"},
|
||||
{".rip", "audio/vnd.rip"},
|
||||
{".hbci", "application/vnd.hbci"},
|
||||
{".jlt", "application/vnd.hp-jlyt"},
|
||||
{".pcl", "application/vnd.hp-pcl"},
|
||||
{".hpgl", "application/vnd.hp-hpgl"},
|
||||
{".hvs", "application/vnd.yamaha.hv-script"},
|
||||
{".hvd", "application/vnd.yamaha.hv-dic"},
|
||||
{".hvp", "application/vnd.yamaha.hv-voice"},
|
||||
{".sfd-hdstx", "application/vnd.hydrostatix.sof-data"},
|
||||
{".stk", "application/hyperstudio"},
|
||||
{".hal", "application/vnd.hal+xml"},
|
||||
{".htm", "text/html; charset=utf-8"},
|
||||
{".html", "text/html; charset=utf-8"},
|
||||
{".irm", "application/vnd.ibm.rights-management"},
|
||||
{".sc", "application/vnd.ibm.secure-container"},
|
||||
{".ics", "text/calendar"},
|
||||
{".icc", "application/vnd.iccprofile"},
|
||||
{".ico", "image/x-icon"},
|
||||
{".igl", "application/vnd.igloader"},
|
||||
{".ief", "image/ief"},
|
||||
{".ivp", "application/vnd.immervision-ivp"},
|
||||
{".ivu", "application/vnd.immervision-ivu"},
|
||||
{".rif", "application/reginfo+xml"},
|
||||
{".3dml", "text/vnd.in3d.3dml"},
|
||||
{".spot", "text/vnd.in3d.spot"},
|
||||
{".igs", "model/iges"},
|
||||
{".i2g", "application/vnd.intergeo"},
|
||||
{".cdy", "application/vnd.cinderella"},
|
||||
{".xpw", "application/vnd.intercon.formnet"},
|
||||
{".fcs", "application/vnd.isac.fcs"},
|
||||
{".ipfix", "application/ipfix"},
|
||||
{".cer", "application/pkix-cert"},
|
||||
{".pki", "application/pkixcmp"},
|
||||
{".crl", "application/pkix-crl"},
|
||||
{".pkipath", "application/pkix-pkipath"},
|
||||
{".igm", "application/vnd.insors.igm"},
|
||||
{".rcprofile", "application/vnd.ipunplugged.rcprofile"},
|
||||
{".irp", "application/vnd.irepository.package+xml"},
|
||||
{".jad", "text/vnd.sun.j2me.app-descriptor"},
|
||||
{".jar", "application/java-archive"},
|
||||
{".class", "application/java-vm"},
|
||||
{".jnlp", "application/x-java-jnlp-file"},
|
||||
{".ser", "application/java-serialized-object"},
|
||||
{".java", "text/x-java-source"},
|
||||
{".js", "application/javascript"},
|
||||
{".json", "application/json"},
|
||||
{".joda", "application/vnd.joost.joda-archive"},
|
||||
{".jpm", "video/jpm"},
|
||||
{".jpg", "image/jpeg"},
|
||||
{".jpeg", "image/jpeg"},
|
||||
{".pjpeg", "image/pjpeg"},
|
||||
{".jpgv", "video/jpeg"},
|
||||
{".ktz", "application/vnd.kahootz"},
|
||||
{".mmd", "application/vnd.chipnuts.karaoke-mmd"},
|
||||
{".karbon", "application/vnd.kde.karbon"},
|
||||
{".chrt", "application/vnd.kde.kchart"},
|
||||
{".kfo", "application/vnd.kde.kformula"},
|
||||
{".flw", "application/vnd.kde.kivio"},
|
||||
{".kon", "application/vnd.kde.kontour"},
|
||||
{".kpr", "application/vnd.kde.kpresenter"},
|
||||
{".ksp", "application/vnd.kde.kspread"},
|
||||
{".kwd", "application/vnd.kde.kword"},
|
||||
{".htke", "application/vnd.kenameaapp"},
|
||||
{".kia", "application/vnd.kidspiration"},
|
||||
{".kne", "application/vnd.kinar"},
|
||||
{".sse", "application/vnd.kodak-descriptor"},
|
||||
{".lasxml", "application/vnd.las.las+xml"},
|
||||
{".latex", "application/x-latex"},
|
||||
{".lbd", "application/vnd.llamagraphics.life-balance.desktop"},
|
||||
{".lbe", "application/vnd.llamagraphics.life-balance.exchange+xml"},
|
||||
{".jam", "application/vnd.jam"},
|
||||
{"0.123", "application/vnd.lotus-1-2-3"},
|
||||
{".apr", "application/vnd.lotus-approach"},
|
||||
{".pre", "application/vnd.lotus-freelance"},
|
||||
{".nsf", "application/vnd.lotus-notes"},
|
||||
{".org", "application/vnd.lotus-organizer"},
|
||||
{".scm", "application/vnd.lotus-screencam"},
|
||||
{".lwp", "application/vnd.lotus-wordpro"},
|
||||
{".lvp", "audio/vnd.lucent.voice"},
|
||||
{".m3u", "audio/x-mpegurl"},
|
||||
{".m4v", "video/x-m4v"},
|
||||
{".hqx", "application/mac-binhex40"},
|
||||
{".portpkg", "application/vnd.macports.portpkg"},
|
||||
{".mgp", "application/vnd.osgeo.mapguide.package"},
|
||||
{".mrc", "application/marc"},
|
||||
{".mrcx", "application/marcxml+xml"},
|
||||
{".mxf", "application/mxf"},
|
||||
{".nbp", "application/vnd.wolfram.player"},
|
||||
{".ma", "application/mathematica"},
|
||||
{".mathml", "application/mathml+xml"},
|
||||
{".mbox", "application/mbox"},
|
||||
{".mc1", "application/vnd.medcalcdata"},
|
||||
{".mscml", "application/mediaservercontrol+xml"},
|
||||
{".cdkey", "application/vnd.mediastation.cdkey"},
|
||||
{".mwf", "application/vnd.mfer"},
|
||||
{".mfm", "application/vnd.mfmp"},
|
||||
{".msh", "model/mesh"},
|
||||
{".mads", "application/mads+xml"},
|
||||
{".mets", "application/mets+xml"},
|
||||
{".mods", "application/mods+xml"},
|
||||
{".meta4", "application/metalink4+xml"},
|
||||
{".mcd", "application/vnd.mcd"},
|
||||
{".flo", "application/vnd.micrografx.flo"},
|
||||
{".igx", "application/vnd.micrografx.igx"},
|
||||
{".es3", "application/vnd.eszigno3+xml"},
|
||||
{".mdb", "application/x-msaccess"},
|
||||
{".asf", "video/x-ms-asf"},
|
||||
{".exe", "application/x-msdownload"},
|
||||
{".cil", "application/vnd.ms-artgalry"},
|
||||
{".cab", "application/vnd.ms-cab-compressed"},
|
||||
{".ims", "application/vnd.ms-ims"},
|
||||
{".application", "application/x-ms-application"},
|
||||
{".clp", "application/x-msclip"},
|
||||
{".mdi", "image/vnd.ms-modi"},
|
||||
{".eot", "application/vnd.ms-fontobject"},
|
||||
{".xls", "application/vnd.ms-excel"},
|
||||
{".xlam", "application/vnd.ms-excel.addin.macroenabled.12"},
|
||||
{".xlsb", "application/vnd.ms-excel.sheet.binary.macroenabled.12"},
|
||||
{".xltm", "application/vnd.ms-excel.template.macroenabled.12"},
|
||||
{".xlsm", "application/vnd.ms-excel.sheet.macroenabled.12"},
|
||||
{".chm", "application/vnd.ms-htmlhelp"},
|
||||
{".crd", "application/x-mscardfile"},
|
||||
{".lrm", "application/vnd.ms-lrm"},
|
||||
{".mvb", "application/x-msmediaview"},
|
||||
{".mny", "application/x-msmoney"},
|
||||
{".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"},
|
||||
{".sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide"},
|
||||
{".ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow"},
|
||||
{".potx", "application/vnd.openxmlformats-officedocument.presentationml.template"},
|
||||
{".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
|
||||
{".xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template"},
|
||||
{".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
|
||||
{".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template"},
|
||||
{".obd", "application/x-msbinder"},
|
||||
{".thmx", "application/vnd.ms-officetheme"},
|
||||
{".onetoc", "application/onenote"},
|
||||
{".pya", "audio/vnd.ms-playready.media.pya"},
|
||||
{".pyv", "video/vnd.ms-playready.media.pyv"},
|
||||
{".ppt", "application/vnd.ms-powerpoint"},
|
||||
{".ppam", "application/vnd.ms-powerpoint.addin.macroenabled.12"},
|
||||
{".sldm", "application/vnd.ms-powerpoint.slide.macroenabled.12"},
|
||||
{".pptm", "application/vnd.ms-powerpoint.presentation.macroenabled.12"},
|
||||
{".ppsm", "application/vnd.ms-powerpoint.slideshow.macroenabled.12"},
|
||||
{".potm", "application/vnd.ms-powerpoint.template.macroenabled.12"},
|
||||
{".mpp", "application/vnd.ms-project"},
|
||||
{".pub", "application/x-mspublisher"},
|
||||
{".scd", "application/x-msschedule"},
|
||||
{".xap", "application/x-silverlight-app"},
|
||||
{".stl", "application/vnd.ms-pki.stl"},
|
||||
{".cat", "application/vnd.ms-pki.seccat"},
|
||||
{".vsd", "application/vnd.visio"},
|
||||
{".vsdx", "application/vnd.visio2013"},
|
||||
{".wm", "video/x-ms-wm"},
|
||||
{".wma", "audio/x-ms-wma"},
|
||||
{".wax", "audio/x-ms-wax"},
|
||||
{".wmx", "video/x-ms-wmx"},
|
||||
{".wmd", "application/x-ms-wmd"},
|
||||
{".wpl", "application/vnd.ms-wpl"},
|
||||
{".wmz", "application/x-ms-wmz"},
|
||||
{".wmv", "video/x-ms-wmv"},
|
||||
{".wvx", "video/x-ms-wvx"},
|
||||
{".wmf", "application/x-msmetafile"},
|
||||
{".trm", "application/x-msterminal"},
|
||||
{".doc", "application/msword"},
|
||||
{".docm", "application/vnd.ms-word.document.macroenabled.12"},
|
||||
{".dotm", "application/vnd.ms-word.template.macroenabled.12"},
|
||||
{".wri", "application/x-mswrite"},
|
||||
{".wps", "application/vnd.ms-works"},
|
||||
{".xbap", "application/x-ms-xbap"},
|
||||
{".xps", "application/vnd.ms-xpsdocument"},
|
||||
{".mid", "audio/midi"},
|
||||
{".mpy", "application/vnd.ibm.minipay"},
|
||||
{".afp", "application/vnd.ibm.modcap"},
|
||||
{".rms", "application/vnd.jcp.javame.midlet-rms"},
|
||||
{".tmo", "application/vnd.tmobile-livetv"},
|
||||
{".prc", "application/x-mobipocket-ebook"},
|
||||
{".mbk", "application/vnd.mobius.mbk"},
|
||||
{".dis", "application/vnd.mobius.dis"},
|
||||
{".plc", "application/vnd.mobius.plc"},
|
||||
{".mqy", "application/vnd.mobius.mqy"},
|
||||
{".msl", "application/vnd.mobius.msl"},
|
||||
{".txf", "application/vnd.mobius.txf"},
|
||||
{".daf", "application/vnd.mobius.daf"},
|
||||
{".fly", "text/vnd.fly"},
|
||||
{".mpc", "application/vnd.mophun.certificate"},
|
||||
{".mpn", "application/vnd.mophun.application"},
|
||||
{".mj2", "video/mj2"},
|
||||
{".mpga", "audio/mpeg"},
|
||||
{".mxu", "video/vnd.mpegurl"},
|
||||
{".mpeg", "video/mpeg"},
|
||||
{".m21", "application/mp21"},
|
||||
{".mp4a", "audio/mp4"},
|
||||
{".mp4", "video/mp4"},
|
||||
{".mp4", "application/mp4"},
|
||||
{".m3u8", "application/vnd.apple.mpegurl"},
|
||||
{".mus", "application/vnd.musician"},
|
||||
{".msty", "application/vnd.muvee.style"},
|
||||
{".mxml", "application/xv+xml"},
|
||||
{".ngdat", "application/vnd.nokia.n-gage.data"},
|
||||
{".n-gage", "application/vnd.nokia.n-gage.symbian.install"},
|
||||
{".ncx", "application/x-dtbncx+xml"},
|
||||
{".nc", "application/x-netcdf"},
|
||||
{".nlu", "application/vnd.neurolanguage.nlu"},
|
||||
{".dna", "application/vnd.dna"},
|
||||
{".nnd", "application/vnd.noblenet-directory"},
|
||||
{".nns", "application/vnd.noblenet-sealer"},
|
||||
{".nnw", "application/vnd.noblenet-web"},
|
||||
{".rpst", "application/vnd.nokia.radio-preset"},
|
||||
{".rpss", "application/vnd.nokia.radio-presets"},
|
||||
{".n3", "text/n3"},
|
||||
{".edm", "application/vnd.novadigm.edm"},
|
||||
{".edx", "application/vnd.novadigm.edx"},
|
||||
{".ext", "application/vnd.novadigm.ext"},
|
||||
{".gph", "application/vnd.flographit"},
|
||||
{".ecelp4800", "audio/vnd.nuera.ecelp4800"},
|
||||
{".ecelp7470", "audio/vnd.nuera.ecelp7470"},
|
||||
{".ecelp9600", "audio/vnd.nuera.ecelp9600"},
|
||||
{".oda", "application/oda"},
|
||||
{".ogx", "application/ogg"},
|
||||
{".oga", "audio/ogg"},
|
||||
{".ogv", "video/ogg"},
|
||||
{".dd2", "application/vnd.oma.dd2+xml"},
|
||||
{".oth", "application/vnd.oasis.opendocument.text-web"},
|
||||
{".opf", "application/oebps-package+xml"},
|
||||
{".qbo", "application/vnd.intu.qbo"},
|
||||
{".oxt", "application/vnd.openofficeorg.extension"},
|
||||
{".osf", "application/vnd.yamaha.openscoreformat"},
|
||||
{".weba", "audio/webm"},
|
||||
{".webm", "video/webm"},
|
||||
{".odc", "application/vnd.oasis.opendocument.chart"},
|
||||
{".otc", "application/vnd.oasis.opendocument.chart-template"},
|
||||
{".odb", "application/vnd.oasis.opendocument.database"},
|
||||
{".odf", "application/vnd.oasis.opendocument.formula"},
|
||||
{".odft", "application/vnd.oasis.opendocument.formula-template"},
|
||||
{".odg", "application/vnd.oasis.opendocument.graphics"},
|
||||
{".otg", "application/vnd.oasis.opendocument.graphics-template"},
|
||||
{".odi", "application/vnd.oasis.opendocument.image"},
|
||||
{".oti", "application/vnd.oasis.opendocument.image-template"},
|
||||
{".odp", "application/vnd.oasis.opendocument.presentation"},
|
||||
{".otp", "application/vnd.oasis.opendocument.presentation-template"},
|
||||
{".ods", "application/vnd.oasis.opendocument.spreadsheet"},
|
||||
{".ots", "application/vnd.oasis.opendocument.spreadsheet-template"},
|
||||
{".odt", "application/vnd.oasis.opendocument.text"},
|
||||
{".odm", "application/vnd.oasis.opendocument.text-master"},
|
||||
{".ott", "application/vnd.oasis.opendocument.text-template"},
|
||||
{".ktx", "image/ktx"},
|
||||
{".sxc", "application/vnd.sun.xml.calc"},
|
||||
{".stc", "application/vnd.sun.xml.calc.template"},
|
||||
{".sxd", "application/vnd.sun.xml.draw"},
|
||||
{".std", "application/vnd.sun.xml.draw.template"},
|
||||
{".sxi", "application/vnd.sun.xml.impress"},
|
||||
{".sti", "application/vnd.sun.xml.impress.template"},
|
||||
{".sxm", "application/vnd.sun.xml.math"},
|
||||
{".sxw", "application/vnd.sun.xml.writer"},
|
||||
{".sxg", "application/vnd.sun.xml.writer.global"},
|
||||
{".stw", "application/vnd.sun.xml.writer.template"},
|
||||
{".otf", "application/x-font-otf"},
|
||||
{".osfpvg", "application/vnd.yamaha.openscoreformat.osfpvg+xml"},
|
||||
{".dp", "application/vnd.osgi.dp"},
|
||||
{".pdb", "application/vnd.palm"},
|
||||
{".p", "text/x-pascal"},
|
||||
{".paw", "application/vnd.pawaafile"},
|
||||
{".pclxl", "application/vnd.hp-pclxl"},
|
||||
{".efif", "application/vnd.picsel"},
|
||||
{".pcx", "image/x-pcx"},
|
||||
{".psd", "image/vnd.adobe.photoshop"},
|
||||
{".prf", "application/pics-rules"},
|
||||
{".pic", "image/x-pict"},
|
||||
{".chat", "application/x-chat"},
|
||||
{".p10", "application/pkcs10"},
|
||||
{".p12", "application/x-pkcs12"},
|
||||
{".p7m", "application/pkcs7-mime"},
|
||||
{".p7s", "application/pkcs7-signature"},
|
||||
{".p7r", "application/x-pkcs7-certreqresp"},
|
||||
{".p7b", "application/x-pkcs7-certificates"},
|
||||
{".p8", "application/pkcs8"},
|
||||
{".plf", "application/vnd.pocketlearn"},
|
||||
{".pnm", "image/x-portable-anymap"},
|
||||
{".pbm", "image/x-portable-bitmap"},
|
||||
{".pcf", "application/x-font-pcf"},
|
||||
{".pfr", "application/font-tdpfr"},
|
||||
{".pgn", "application/x-chess-pgn"},
|
||||
{".pgm", "image/x-portable-graymap"},
|
||||
{".png", "image/png"},
|
||||
{".png", "image/x-citrix-png"},
|
||||
{".png", "image/x-png"},
|
||||
{".ppm", "image/x-portable-pixmap"},
|
||||
{".pskcxml", "application/pskc+xml"},
|
||||
{".pml", "application/vnd.ctc-posml"},
|
||||
{".ai", "application/postscript"},
|
||||
{".pfa", "application/x-font-type1"},
|
||||
{".pbd", "application/vnd.powerbuilder6"},
|
||||
{".pgp", "application/pgp-encrypted"},
|
||||
{".pgp", "application/pgp-signature"},
|
||||
{".box", "application/vnd.previewsystems.box"},
|
||||
{".ptid", "application/vnd.pvi.ptid1"},
|
||||
{".pls", "application/pls+xml"},
|
||||
{".str", "application/vnd.pg.format"},
|
||||
{".ei6", "application/vnd.pg.osasli"},
|
||||
{".dsc", "text/prs.lines.tag"},
|
||||
{".psf", "application/x-font-linux-psf"},
|
||||
{".qps", "application/vnd.publishare-delta-tree"},
|
||||
{".wg", "application/vnd.pmi.widget"},
|
||||
{".qxd", "application/vnd.quark.quarkxpress"},
|
||||
{".esf", "application/vnd.epson.esf"},
|
||||
{".msf", "application/vnd.epson.msf"},
|
||||
{".ssf", "application/vnd.epson.ssf"},
|
||||
{".qam", "application/vnd.epson.quickanime"},
|
||||
{".qfx", "application/vnd.intu.qfx"},
|
||||
{".qt", "video/quicktime"},
|
||||
{".rar", "application/x-rar-compressed"},
|
||||
{".ram", "audio/x-pn-realaudio"},
|
||||
{".rmp", "audio/x-pn-realaudio-plugin"},
|
||||
{".rsd", "application/rsd+xml"},
|
||||
{".rm", "application/vnd.rn-realmedia"},
|
||||
{".bed", "application/vnd.realvnc.bed"},
|
||||
{".mxl", "application/vnd.recordare.musicxml"},
|
||||
{".musicxml", "application/vnd.recordare.musicxml+xml"},
|
||||
{".rnc", "application/relax-ng-compact-syntax"},
|
||||
{".rdz", "application/vnd.data-vision.rdz"},
|
||||
{".rdf", "application/rdf+xml"},
|
||||
{".rp9", "application/vnd.cloanto.rp9"},
|
||||
{".jisp", "application/vnd.jisp"},
|
||||
{".rtf", "application/rtf"},
|
||||
{".rtx", "text/richtext"},
|
||||
{".link66", "application/vnd.route66.link66+xml"},
|
||||
{".rss", "application/rss+xml"},
|
||||
{".shf", "application/shf+xml"},
|
||||
{".st", "application/vnd.sailingtracker.track"},
|
||||
{".svg", "image/svg+xml"},
|
||||
{".sus", "application/vnd.sus-calendar"},
|
||||
{".sru", "application/sru+xml"},
|
||||
{".setpay", "application/set-payment-initiation"},
|
||||
{".setreg", "application/set-registration-initiation"},
|
||||
{".sema", "application/vnd.sema"},
|
||||
{".semd", "application/vnd.semd"},
|
||||
{".semf", "application/vnd.semf"},
|
||||
{".see", "application/vnd.seemail"},
|
||||
{".snf", "application/x-font-snf"},
|
||||
{".spq", "application/scvp-vp-request"},
|
||||
{".spp", "application/scvp-vp-response"},
|
||||
{".scq", "application/scvp-cv-request"},
|
||||
{".scs", "application/scvp-cv-response"},
|
||||
{".sdp", "application/sdp"},
|
||||
{".etx", "text/x-setext"},
|
||||
{".movie", "video/x-sgi-movie"},
|
||||
{".ifm", "application/vnd.shana.informed.formdata"},
|
||||
{".itp", "application/vnd.shana.informed.formtemplate"},
|
||||
{".iif", "application/vnd.shana.informed.interchange"},
|
||||
{".ipk", "application/vnd.shana.informed.package"},
|
||||
{".tfi", "application/thraud+xml"},
|
||||
{".shar", "application/x-shar"},
|
||||
{".rgb", "image/x-rgb"},
|
||||
{".slt", "application/vnd.epson.salt"},
|
||||
{".aso", "application/vnd.accpac.simply.aso"},
|
||||
{".imp", "application/vnd.accpac.simply.imp"},
|
||||
{".twd", "application/vnd.simtech-mindmapper"},
|
||||
{".csp", "application/vnd.commonspace"},
|
||||
{".saf", "application/vnd.yamaha.smaf-audio"},
|
||||
{".mmf", "application/vnd.smaf"},
|
||||
{".spf", "application/vnd.yamaha.smaf-phrase"},
|
||||
{".teacher", "application/vnd.smart.teacher"},
|
||||
{".svd", "application/vnd.svd"},
|
||||
{".rq", "application/sparql-query"},
|
||||
{".srx", "application/sparql-results+xml"},
|
||||
{".gram", "application/srgs"},
|
||||
{".grxml", "application/srgs+xml"},
|
||||
{".ssml", "application/ssml+xml"},
|
||||
{".skp", "application/vnd.koan"},
|
||||
{".sgml", "text/sgml"},
|
||||
{".sdc", "application/vnd.stardivision.calc"},
|
||||
{".sda", "application/vnd.stardivision.draw"},
|
||||
{".sdd", "application/vnd.stardivision.impress"},
|
||||
{".smf", "application/vnd.stardivision.math"},
|
||||
{".sdw", "application/vnd.stardivision.writer"},
|
||||
{".sgl", "application/vnd.stardivision.writer-global"},
|
||||
{".sm", "application/vnd.stepmania.stepchart"},
|
||||
{".sit", "application/x-stuffit"},
|
||||
{".sitx", "application/x-stuffitx"},
|
||||
{".sdkm", "application/vnd.solent.sdkm+xml"},
|
||||
{".xo", "application/vnd.olpc-sugar"},
|
||||
{".au", "audio/basic"},
|
||||
{".wqd", "application/vnd.wqd"},
|
||||
{".sis", "application/vnd.symbian.install"},
|
||||
{".smi", "application/smil+xml"},
|
||||
{".xsm", "application/vnd.syncml+xml"},
|
||||
{".bdm", "application/vnd.syncml.dm+wbxml"},
|
||||
{".xdm", "application/vnd.syncml.dm+xml"},
|
||||
{".sv4cpio", "application/x-sv4cpio"},
|
||||
{".sv4crc", "application/x-sv4crc"},
|
||||
{".sbml", "application/sbml+xml"},
|
||||
{".tsv", "text/tab-separated-values"},
|
||||
{".tiff", "image/tiff"},
|
||||
{".tao", "application/vnd.tao.intent-module-archive"},
|
||||
{".tar", "application/x-tar"},
|
||||
{".tcl", "application/x-tcl"},
|
||||
{".tex", "application/x-tex"},
|
||||
{".tfm", "application/x-tex-tfm"},
|
||||
{".tei", "application/tei+xml"},
|
||||
{".txt", "text/plain; charset=utf-8"},
|
||||
{".md", "text/markdown; charset=utf-8"},
|
||||
{".dxp", "application/vnd.spotfire.dxp"},
|
||||
{".sfs", "application/vnd.spotfire.sfs"},
|
||||
{".tsd", "application/timestamped-data"},
|
||||
{".tpt", "application/vnd.trid.tpt"},
|
||||
{".mxs", "application/vnd.triscape.mxs"},
|
||||
{".t", "text/troff"},
|
||||
{".tra", "application/vnd.trueapp"},
|
||||
{".ttf", "application/x-font-ttf"},
|
||||
{".ttl", "text/turtle"},
|
||||
{".umj", "application/vnd.umajin"},
|
||||
{".uoml", "application/vnd.uoml+xml"},
|
||||
{".unityweb", "application/vnd.unity"},
|
||||
{".ufd", "application/vnd.ufdl"},
|
||||
{".uri", "text/uri-list"},
|
||||
{".utz", "application/vnd.uiq.theme"},
|
||||
{".ustar", "application/x-ustar"},
|
||||
{".uu", "text/x-uuencode"},
|
||||
{".vcs", "text/x-vcalendar"},
|
||||
{".vcf", "text/x-vcard"},
|
||||
{".vcd", "application/x-cdlink"},
|
||||
{".vsf", "application/vnd.vsf"},
|
||||
{".wrl", "model/vrml"},
|
||||
{".vcx", "application/vnd.vcx"},
|
||||
{".mts", "model/vnd.mts"},
|
||||
{".vtu", "model/vnd.vtu"},
|
||||
{".vis", "application/vnd.visionary"},
|
||||
{".viv", "video/vnd.vivo"},
|
||||
{".ccxml", "application/ccxml+xml"},
|
||||
{".vxml", "application/voicexml+xml"},
|
||||
{".src", "application/x-wais-source"},
|
||||
{".wbxml", "application/vnd.wap.wbxml"},
|
||||
{".wbmp", "image/vnd.wap.wbmp"},
|
||||
{".wav", "audio/x-wav"},
|
||||
{".davmount", "application/davmount+xml"},
|
||||
{".woff", "application/x-font-woff"},
|
||||
{".wspolicy", "application/wspolicy+xml"},
|
||||
{".webp", "image/webp"},
|
||||
{".wtb", "application/vnd.webturbo"},
|
||||
{".wgt", "application/widget"},
|
||||
{".hlp", "application/winhlp"},
|
||||
{".wml", "text/vnd.wap.wml"},
|
||||
{".wmls", "text/vnd.wap.wmlscript"},
|
||||
{".wmlsc", "application/vnd.wap.wmlscriptc"},
|
||||
{".wpd", "application/vnd.wordperfect"},
|
||||
{".stf", "application/vnd.wt.stf"},
|
||||
{".wsdl", "application/wsdl+xml"},
|
||||
{".xbm", "image/x-xbitmap"},
|
||||
{".xpm", "image/x-xpixmap"},
|
||||
{".xwd", "image/x-xwindowdump"},
|
||||
{".der", "application/x-x509-ca-cert"},
|
||||
{".fig", "application/x-xfig"},
|
||||
{".xhtml", "application/xhtml+xml"},
|
||||
{".xml", "application/xml"},
|
||||
{".xdf", "application/xcap-diff+xml"},
|
||||
{".xenc", "application/xenc+xml"},
|
||||
{".xer", "application/patch-ops-error+xml"},
|
||||
{".rl", "application/resource-lists+xml"},
|
||||
{".rs", "application/rls-services+xml"},
|
||||
{".rld", "application/resource-lists-diff+xml"},
|
||||
{".xslt", "application/xslt+xml"},
|
||||
{".xop", "application/xop+xml"},
|
||||
{".xpi", "application/x-xpinstall"},
|
||||
{".xspf", "application/xspf+xml"},
|
||||
{".xul", "application/vnd.mozilla.xul+xml"},
|
||||
{".xyz", "chemical/x-xyz"},
|
||||
{".yaml", "text/yaml"},
|
||||
{".yang", "application/yang"},
|
||||
{".yin", "application/yin+xml"},
|
||||
{".zir", "application/vnd.zul"},
|
||||
{".zip", "application/zip"},
|
||||
{".zmm", "application/vnd.handheld-entertainment+xml"},
|
||||
{".zaz", "application/vnd.zzazz.deck+xml"},
|
||||
};
|
||||
|
||||
// Get HTTP MIME type from filename
|
||||
char *GetMimeTypeFromFileName(char *filename)
|
||||
{
|
||||
UINT i;
|
||||
UINT num = sizeof(http_mime_types) / sizeof(HTTP_MIME_TYPE);
|
||||
if (filename == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0;i < num;i++)
|
||||
{
|
||||
HTTP_MIME_TYPE *a = &http_mime_types[i];
|
||||
|
||||
if (EndWith(filename, a->Extension))
|
||||
{
|
||||
return a->MimeType;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Download and save intermediate certificates if necessary
|
||||
bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x)
|
||||
{
|
||||
@ -1183,6 +1903,11 @@ bool ServerAccept(CONNECTION *c)
|
||||
error_detail_2 = NULL;
|
||||
if (ServerDownloadSignature(c, &error_detail_2) == false)
|
||||
{
|
||||
if (c->Type == CONNECTION_TYPE_ADMIN_RPC)
|
||||
{
|
||||
c->Err = ERR_NO_ERROR;
|
||||
}
|
||||
|
||||
if (error_detail_2 == NULL)
|
||||
{
|
||||
error_detail = "ServerDownloadSignature";
|
||||
@ -5045,11 +5770,11 @@ PACK *PackWelcome(SESSION *s)
|
||||
}
|
||||
|
||||
#define PACK_ADD_POLICY_BOOL(name, value) \
|
||||
PackAddInt(p, "policy:" name, y->value == false ? 0 : 1)
|
||||
PackAddBool(p, "policy:" name, y->value == false ? 0 : 1)
|
||||
#define PACK_ADD_POLICY_UINT(name, value) \
|
||||
PackAddInt(p, "policy:" name, y->value)
|
||||
#define PACK_GET_POLICY_BOOL(name, value) \
|
||||
y->value = (PackGetInt(p, "policy:" name) == 0 ? false : true)
|
||||
y->value = (PackGetBool(p, "policy:" name))
|
||||
#define PACK_GET_POLICY_UINT(name, value) \
|
||||
y->value = PackGetInt(p, "policy:" name)
|
||||
|
||||
@ -5560,6 +6285,10 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
if (h == NULL)
|
||||
{
|
||||
c->Err = ERR_CLIENT_IS_NOT_VPN;
|
||||
if (c->IsJsonRpc)
|
||||
{
|
||||
c->Err = ERR_DISCONNECTED;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5568,6 +6297,43 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
{
|
||||
// Receive the data since it's POST
|
||||
data_size = GetContentLength(h);
|
||||
|
||||
if (server->DisableJsonRpcWebApi == false)
|
||||
{
|
||||
if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0)
|
||||
{
|
||||
c->IsJsonRpc = true;
|
||||
c->Type = CONNECTION_TYPE_ADMIN_RPC;
|
||||
|
||||
JsonRpcProcPost(c, s, h, data_size);
|
||||
|
||||
FreeHttpHeader(h);
|
||||
|
||||
if (c->JsonRpcAuthed)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (StartWith(h->Target, "/admin"))
|
||||
{
|
||||
c->IsJsonRpc = true;
|
||||
c->Type = CONNECTION_TYPE_ADMIN_RPC;
|
||||
|
||||
AdminWebProcPost(c, s, h, data_size, h->Target);
|
||||
|
||||
FreeHttpHeader(h);
|
||||
|
||||
if (c->JsonRpcAuthed)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((data_size > MAX_WATERMARK_SIZE || data_size < SizeOfWaterMark()) && (data_size != StrLen(HTTP_VPN_TARGET_POSTDATA)))
|
||||
{
|
||||
// Data is too large
|
||||
@ -5616,6 +6382,25 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (StrCmpi(h->Method, "OPTIONS") == 0)
|
||||
{
|
||||
if (server->DisableJsonRpcWebApi == false)
|
||||
{
|
||||
if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0 || StartWith(h->Target, "/admin"))
|
||||
{
|
||||
c->IsJsonRpc = true;
|
||||
c->Type = CONNECTION_TYPE_ADMIN_RPC;
|
||||
|
||||
JsonRpcProcOptions(c, s, h, h->Target);
|
||||
|
||||
FreeHttpHeader(h);
|
||||
|
||||
num = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (StrCmpi(h->Method, "SSTP_DUPLEX_POST") == 0 && (server->DisableSSTPServer == false || s->IsReverseAcceptedSocket
|
||||
) &&
|
||||
GetServerCapsBool(server, "b_support_sstp") && GetNoSstp() == false)
|
||||
@ -5733,6 +6518,45 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
}
|
||||
}
|
||||
|
||||
if (b == false)
|
||||
{
|
||||
if (server->DisableJsonRpcWebApi == false)
|
||||
{
|
||||
if (StartWith(h->Target, "/api?") || StartWith(h->Target, "/api/") || StrCmpi(h->Target, "/api") == 0)
|
||||
{
|
||||
c->IsJsonRpc = true;
|
||||
c->Type = CONNECTION_TYPE_ADMIN_RPC;
|
||||
|
||||
JsonRpcProcGet(c, s, h, h->Target);
|
||||
|
||||
if (c->JsonRpcAuthed)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
|
||||
FreeHttpHeader(h);
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (StartWith(h->Target, "/admin"))
|
||||
{
|
||||
c->IsJsonRpc = true;
|
||||
c->Type = CONNECTION_TYPE_ADMIN_RPC;
|
||||
|
||||
AdminWebProcGet(c, s, h, h->Target);
|
||||
|
||||
if (c->JsonRpcAuthed)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
|
||||
FreeHttpHeader(h);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (b == false)
|
||||
{
|
||||
// Not Found
|
||||
|
@ -8,6 +8,13 @@
|
||||
#ifndef PROTOCOL_H
|
||||
#define PROTOCOL_H
|
||||
|
||||
// MIME types
|
||||
struct HTTP_MIME_TYPE
|
||||
{
|
||||
char *Extension;
|
||||
char *MimeType;
|
||||
};
|
||||
|
||||
// The parameters that will be passed to the certificate confirmation thread
|
||||
struct CHECK_CERT_THREAD_PROC
|
||||
{
|
||||
@ -190,6 +197,6 @@ X *FindCertIssuerFromCertList(LIST *o, X *x);
|
||||
bool TryGetRootCertChain(LIST *o, X *x, bool auto_save, X **found_root_x);
|
||||
bool TryGetParentCertFromCertList(LIST *o, X *x, LIST *found_chain);
|
||||
bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x);
|
||||
|
||||
char *GetMimeTypeFromFileName(char *filename);
|
||||
|
||||
#endif // PROTOCOL_H
|
||||
|
@ -15,6 +15,10 @@ void EndRpc(RPC *rpc)
|
||||
|
||||
// Release the RPC
|
||||
void RpcFree(RPC *rpc)
|
||||
{
|
||||
RpcFreeEx(rpc, false);
|
||||
}
|
||||
void RpcFreeEx(RPC *rpc, bool no_disconnect)
|
||||
{
|
||||
// Validate arguments
|
||||
if (rpc == NULL)
|
||||
@ -22,7 +26,11 @@ void RpcFree(RPC *rpc)
|
||||
return;
|
||||
}
|
||||
|
||||
Disconnect(rpc->Sock);
|
||||
if (no_disconnect == false)
|
||||
{
|
||||
Disconnect(rpc->Sock);
|
||||
}
|
||||
|
||||
ReleaseSock(rpc->Sock);
|
||||
|
||||
DeleteLock(rpc->Lock);
|
||||
|
@ -42,6 +42,7 @@ bool RpcIsOk(PACK *p);
|
||||
UINT RpcGetError(PACK *p);
|
||||
void EndRpc(RPC *rpc);
|
||||
void RpcFree(RPC *rpc);
|
||||
void RpcFreeEx(RPC *rpc, bool no_disconnect);
|
||||
|
||||
#endif // REMOTE_H
|
||||
|
||||
|
@ -974,52 +974,70 @@ LIST *EnumLogFile(char *hubname)
|
||||
|
||||
// Enumerate in the packet_log
|
||||
Format(tmp, sizeof(tmp), "%s/packet_log", exe_dir);
|
||||
dir = EnumDir(tmp);
|
||||
if (dir != NULL)
|
||||
|
||||
if (hubname == NULL)
|
||||
{
|
||||
UINT i;
|
||||
for (i = 0;i < dir->NumFiles;i++)
|
||||
dir = EnumDir(tmp);
|
||||
if (dir != NULL)
|
||||
{
|
||||
DIRENT *e = dir->File[i];
|
||||
|
||||
if (e->Folder)
|
||||
UINT i;
|
||||
for (i = 0;i < dir->NumFiles;i++)
|
||||
{
|
||||
char dir_name[MAX_PATH];
|
||||
DIRENT *e = dir->File[i];
|
||||
|
||||
if (hubname == NULL || StrCmpi(hubname, e->FileName) == 0)
|
||||
if (e->Folder)
|
||||
{
|
||||
char dir_name[MAX_PATH];
|
||||
Format(dir_name, sizeof(dir_name), "packet_log/%s", e->FileName);
|
||||
EnumLogFileDir(o, dir_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreeDir(dir);
|
||||
FreeDir(dir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char dir_name[MAX_PATH];
|
||||
|
||||
Format(dir_name, sizeof(dir_name), "packet_log/%s", hubname);
|
||||
|
||||
EnumLogFileDir(o, dir_name);
|
||||
}
|
||||
|
||||
// Enumerate in the security_log
|
||||
Format(tmp, sizeof(tmp), "%s/security_log", exe_dir);
|
||||
dir = EnumDir(tmp);
|
||||
if (dir != NULL)
|
||||
|
||||
if (hubname == NULL)
|
||||
{
|
||||
UINT i;
|
||||
for (i = 0;i < dir->NumFiles;i++)
|
||||
dir = EnumDir(tmp);
|
||||
if (dir != NULL)
|
||||
{
|
||||
DIRENT *e = dir->File[i];
|
||||
|
||||
if (e->Folder)
|
||||
UINT i;
|
||||
for (i = 0;i < dir->NumFiles;i++)
|
||||
{
|
||||
char dir_name[MAX_PATH];
|
||||
DIRENT *e = dir->File[i];
|
||||
|
||||
if (hubname == NULL || StrCmpi(hubname, e->FileName) == 0)
|
||||
if (e->Folder)
|
||||
{
|
||||
char dir_name[MAX_PATH];
|
||||
|
||||
Format(dir_name, sizeof(dir_name), "security_log/%s", e->FileName);
|
||||
|
||||
EnumLogFileDir(o, dir_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreeDir(dir);
|
||||
FreeDir(dir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char dir_name[MAX_PATH];
|
||||
|
||||
Format(dir_name, sizeof(dir_name), "security_log/%s", hubname);
|
||||
|
||||
EnumLogFileDir(o, dir_name);
|
||||
}
|
||||
|
||||
return o;
|
||||
@ -1731,14 +1749,37 @@ void OutRpcCapsList(PACK *p, CAPSLIST *t)
|
||||
return;
|
||||
}
|
||||
|
||||
PackSetCurrentJsonGroupName(p, "CapsList");
|
||||
for (i = 0;i < LIST_NUM(t->CapsList);i++)
|
||||
{
|
||||
char tmp[MAX_SIZE];
|
||||
char ct_key[MAX_PATH];
|
||||
wchar_t ct_description[MAX_PATH];
|
||||
wchar_t *w;
|
||||
CAPS *c = LIST_DATA(t->CapsList, i);
|
||||
|
||||
Format(tmp, sizeof(tmp), "caps_%s", c->Name);
|
||||
|
||||
Format(ct_key, sizeof(ct_key), "CT_%s", c->Name);
|
||||
|
||||
Zero(ct_description, sizeof(ct_description));
|
||||
w = _UU(ct_key);
|
||||
if (UniIsEmptyStr(w) == false)
|
||||
{
|
||||
UniStrCpy(ct_description, sizeof(ct_description), w);
|
||||
}
|
||||
else
|
||||
{
|
||||
StrToUni(ct_description, sizeof(ct_description), c->Name);
|
||||
}
|
||||
|
||||
PackAddInt(p, tmp, c->Value);
|
||||
|
||||
PackAddStrEx(p, "CapsName", c->Name, i, LIST_NUM(t->CapsList));
|
||||
PackAddIntEx(p, "CapsValue", c->Value, i, LIST_NUM(t->CapsList));
|
||||
PackAddUniStrEx(p, "CapsDescrption", ct_description, i, LIST_NUM(t->CapsList));
|
||||
}
|
||||
PackSetCurrentJsonGroupName(p, NULL);
|
||||
}
|
||||
void FreeRpcCapsList(CAPSLIST *t)
|
||||
{
|
||||
@ -5982,7 +6023,11 @@ void SiLoadServerCfg(SERVER *s, FOLDER *f)
|
||||
c->SslAcceptSettings.Tls_Disable1_2 = CfgGetBool(f, "Tls_Disable1_2");
|
||||
|
||||
s->StrictSyslogDatetimeFormat = CfgGetBool(f, "StrictSyslogDatetimeFormat");
|
||||
// Bits of Diffie-Hellman parameters
|
||||
|
||||
// Disable JSON-RPC Web API
|
||||
s->DisableJsonRpcWebApi = CfgGetBool(f, "DisableJsonRpcWebApi");
|
||||
|
||||
// Bits of Diffie-Hellman parameters
|
||||
c->DhParamBits = CfgGetInt(f, "DhParamBits");
|
||||
if (c->DhParamBits == 0)
|
||||
{
|
||||
@ -6314,6 +6359,9 @@ void SiWriteServerCfg(FOLDER *f, SERVER *s)
|
||||
CfgAddBool(f, "DisableSessionReconnect", GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT));
|
||||
|
||||
CfgAddBool(f, "StrictSyslogDatetimeFormat", s->StrictSyslogDatetimeFormat);
|
||||
|
||||
// Disable JSON-RPC Web API
|
||||
CfgAddBool(f, "DisableJsonRpcWebApi", s->DisableJsonRpcWebApi);
|
||||
}
|
||||
Unlock(c->lock);
|
||||
}
|
||||
@ -7031,7 +7079,7 @@ FARM_MEMBER *SiGetNextFarmMember(SERVER *s, CONNECTION *c, HUB *h)
|
||||
PackAddIntEx(p, "NumTcpConnections", f->NumTcpConnections, i, num);
|
||||
PackAddIntEx(p, "NumHubs", LIST_NUM(f->HubList), i, num);
|
||||
PackAddBoolEx(p, "Me", f->Me, i, num);
|
||||
PackAddInt64Ex(p, "ConnectedTime", f->ConnectedTime, i, num);
|
||||
PackAddTime64Ex(p, "ConnectedTime", f->ConnectedTime, i, num);
|
||||
PackAddInt64Ex(p, "SystemId", f->SystemId, i, num);
|
||||
PackAddBoolEx(p, "DoNotSelect", do_not_select, i, num);
|
||||
}
|
||||
@ -7060,7 +7108,7 @@ FARM_MEMBER *SiGetNextFarmMember(SERVER *s, CONNECTION *c, HUB *h)
|
||||
PackAddStr(p, "CipherName", c->CipherName);
|
||||
PackAddStr(p, "ClientStr", c->ClientStr);
|
||||
PackAddInt(p, "ClientVer", c->ClientVer);
|
||||
PackAddInt64(p, "ConnectedTime", Tick64ToTime64(c->ConnectedTick));
|
||||
PackAddTime64(p, "ConnectedTime", Tick64ToTime64(c->ConnectedTick));
|
||||
|
||||
PackAddStr(p, "HubName", h->Name);
|
||||
PackAddBool(p, "StaticHub", h->Type == HUB_TYPE_FARM_STATIC);
|
||||
@ -7200,8 +7248,8 @@ void SiCalledEnumHub(SERVER *s, PACK *p, PACK *req)
|
||||
|
||||
PackAddIntEx(p, "NumIpTables", LIST_NUM(h->IpTable), i, num);
|
||||
|
||||
PackAddInt64Ex(p, "LastCommTime", h->LastCommTime, i, num);
|
||||
PackAddInt64Ex(p, "CreatedTime", h->CreatedTime, i, num);
|
||||
PackAddTime64Ex(p, "LastCommTime", h->LastCommTime, i, num);
|
||||
PackAddTime64Ex(p, "CreatedTime", h->CreatedTime, i, num);
|
||||
}
|
||||
Unlock(h->lock);
|
||||
}
|
||||
|
@ -267,6 +267,7 @@ struct SERVER
|
||||
|
||||
IP ListenIP; // Listen IP
|
||||
bool StrictSyslogDatetimeFormat; // Make syslog datetime format strict RFC3164
|
||||
bool DisableJsonRpcWebApi; // Disable JSON-RPC Web API
|
||||
};
|
||||
|
||||
|
||||
@ -290,6 +291,7 @@ struct RPC_SESSION_STATUS
|
||||
RPC_CLIENT_GET_CONNECTION_STATUS Status; // Status
|
||||
UINT ClientIp; // Client IP address
|
||||
UCHAR ClientIp6[16]; // Client IPv6 address
|
||||
IP ClientIpAddress; // Client IP address (IPv4/IPv6)
|
||||
char ClientHostName[MAX_HOST_NAME_LEN + 1]; // Client host name
|
||||
NODE_INFO NodeInfo; // Node information
|
||||
};
|
||||
|
@ -108,9 +108,9 @@ void SessionMain(SESSION *s)
|
||||
|
||||
s->NumConnectionsEstablished++;
|
||||
s->CurrentConnectionEstablishTime = Tick64();
|
||||
if (s->FirstConnectionEstablishedTime == 0)
|
||||
if (s->FirstConnectionEstablisiedTime == 0) /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
{
|
||||
s->FirstConnectionEstablishedTime = Tick64();
|
||||
s->FirstConnectionEstablisiedTime = Tick64(); /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
}
|
||||
|
||||
if (s->ServerMode == false && s->Cedar->Client != NULL)
|
||||
@ -1158,7 +1158,10 @@ void StopSessionEx(SESSION *s, bool no_wait)
|
||||
// Server and client mode
|
||||
if (s->Connection)
|
||||
{
|
||||
StopConnection(s->Connection, no_wait);
|
||||
CONNECTION *c = s->Connection;
|
||||
AddRef(c->ref);
|
||||
StopConnection(c, no_wait);
|
||||
ReleaseConnection(c);
|
||||
}
|
||||
|
||||
// Wait until the stop
|
||||
|
@ -157,7 +157,8 @@ struct SESSION
|
||||
UINT NumDisconnected; // Number of socket disconnection
|
||||
bool NoReconnectToSession; // Disable to reconnect to the session
|
||||
char UnderlayProtocol[64]; // Physical communication protocol
|
||||
UINT64 FirstConnectionEstablishedTime; // Connection completion time of the first connection
|
||||
/* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
UINT64 FirstConnectionEstablisiedTime; // Connection completion time of the first connection
|
||||
UINT64 CurrentConnectionEstablishTime; // Completion time of this connection
|
||||
UINT NumConnectionsEstablished; // Number of connections established so far
|
||||
UINT AdjustMss; // MSS adjustment value
|
||||
|
@ -1127,6 +1127,12 @@ void BuildHamcore(char *dst_filename, char *src_dir, bool unix_only)
|
||||
}
|
||||
}
|
||||
|
||||
if (InStr(rpath, "\\node_modules\\"))
|
||||
{
|
||||
// Exclude node_modules in the hamcore\webroot
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
b = ReadDump(s);
|
||||
|
@ -1408,11 +1408,103 @@ void GetDateTimeStrMilli(char *str, UINT size, SYSTEMTIME *st)
|
||||
st->wMilliseconds);
|
||||
}
|
||||
|
||||
|
||||
// Convert string RFC3339 format (example: 2017-09-27T18:25:55.434-9:00) to UINT64
|
||||
UINT64 DateTimeStrRFC3339ToSystemTime64(char *str)
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
if (DateTimeStrRFC3339ToSystemTime(&st, str))
|
||||
{
|
||||
return SystemToUINT64(&st);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert string RFC3339 format (example: 2017-09-27T18:25:55.434-9:00) to SYSTEMTIME
|
||||
bool DateTimeStrRFC3339ToSystemTime(SYSTEMTIME *st, char *str)
|
||||
{
|
||||
bool ok = false;
|
||||
UINT index_plus;
|
||||
char tmp[MAX_PATH];
|
||||
Zero(st, sizeof(SYSTEMTIME));
|
||||
if (st == NULL || str == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
StrCpy(tmp, sizeof(tmp), str);
|
||||
|
||||
index_plus = SearchStrEx(tmp, "+", 0, false);
|
||||
if (index_plus != INFINITE)
|
||||
{
|
||||
tmp[index_plus] = 0;
|
||||
}
|
||||
|
||||
if (StrLen(tmp) >= 19)
|
||||
{
|
||||
if (tmp[4] == '-' && tmp[7] == '-' && tmp[10] == 'T' && tmp[13] == ':' &&
|
||||
tmp[16] == ':')
|
||||
{
|
||||
char str_year[16], str_month[16], str_day[16], str_hour[16], str_minute[16],
|
||||
str_second[16], str_msec[16];
|
||||
|
||||
StrCpy(str_year, sizeof(str_year), tmp + 0);
|
||||
str_year[4] = 0;
|
||||
|
||||
StrCpy(str_month, sizeof(str_month), tmp + 5);
|
||||
str_month[2] = 0;
|
||||
|
||||
StrCpy(str_day, sizeof(str_day), tmp + 8);
|
||||
str_day[2] = 0;
|
||||
|
||||
StrCpy(str_hour, sizeof(str_hour), tmp + 11);
|
||||
str_hour[2] = 0;
|
||||
|
||||
StrCpy(str_minute, sizeof(str_minute), tmp + 14);
|
||||
str_minute[2] = 0;
|
||||
|
||||
StrCpy(str_second, sizeof(str_second), tmp + 17);
|
||||
str_second[2] = 0;
|
||||
|
||||
str_msec[0] = 0;
|
||||
|
||||
if (StrLen(tmp) >= 21 && tmp[19] == '.')
|
||||
{
|
||||
StrCpy(str_msec, sizeof(str_msec), tmp + 20);
|
||||
str_msec[StrLen(tmp) - 21] = 0;
|
||||
while (StrLen(str_msec) < 3)
|
||||
{
|
||||
StrCat(str_msec, sizeof(str_msec), "0");
|
||||
}
|
||||
str_msec[3] = 0;
|
||||
}
|
||||
|
||||
st->wYear = ToInt(str_year);
|
||||
st->wMonth = ToInt(str_month);
|
||||
st->wDay = ToInt(str_day);
|
||||
st->wHour = ToInt(str_hour);
|
||||
st->wMinute = ToInt(str_minute);
|
||||
st->wSecond = ToInt(str_second);
|
||||
st->wMilliseconds = ToInt(str_msec);
|
||||
|
||||
NormalizeSystem(st);
|
||||
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Get the date and time string in RFC3339 format (example: 2017-09-27T18:25:55.434-9:00)
|
||||
void GetDateTimeStrRFC3339(char *str, UINT size, SYSTEMTIME *st, int timezone_min){
|
||||
// Validate arguments
|
||||
if (str == NULL || st == NULL)
|
||||
{
|
||||
ClearStr(str, size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -137,6 +137,8 @@ void GetDateTimeStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale);
|
||||
void GetDateStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale);
|
||||
void GetTimeStrMilli64(char *str, UINT size, UINT64 sec64);
|
||||
void GetDateTimeStrRFC3339(char *str, UINT size, SYSTEMTIME *st, int timezone_min);
|
||||
bool DateTimeStrRFC3339ToSystemTime(SYSTEMTIME *st, char *str);
|
||||
UINT64 DateTimeStrRFC3339ToSystemTime64(char *str);
|
||||
UINT64 SafeTime64(UINT64 sec64);
|
||||
bool Run(char *filename, char *arg, bool hide, bool wait);
|
||||
bool RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait);
|
||||
|
@ -347,6 +347,9 @@ typedef struct PRAND PRAND;
|
||||
// Str.h
|
||||
typedef struct TOKEN_LIST TOKEN_LIST;
|
||||
typedef struct INI_ENTRY INI_ENTRY;
|
||||
typedef struct JSON_OBJECT JSON_OBJECT;
|
||||
typedef struct JSON_ARRAY JSON_ARRAY;
|
||||
typedef struct JSON_VALUE JSON_VALUE;
|
||||
|
||||
// Internat.h
|
||||
typedef struct UNI_TOKEN_LIST UNI_TOKEN_LIST;
|
||||
@ -383,6 +386,8 @@ typedef struct INSTANCE INSTANCE;
|
||||
typedef struct VALUE VALUE;
|
||||
typedef struct ELEMENT ELEMENT;
|
||||
typedef struct PACK PACK;
|
||||
typedef struct JSONPACKHINT JSONPACKHINT;
|
||||
typedef struct JSONPACKHINT_ITEM JSONPACKHINT_ITEM;
|
||||
|
||||
// Cfg.h
|
||||
typedef struct FOLDER FOLDER;
|
||||
|
@ -1413,6 +1413,48 @@ bool ReplaceListPointer(LIST *o, void *oldptr, void *newptr)
|
||||
return false;
|
||||
}
|
||||
|
||||
// New string list
|
||||
LIST *NewStrList()
|
||||
{
|
||||
return NewListFast(CompareStr);
|
||||
}
|
||||
|
||||
// Release string list
|
||||
void ReleaseStrList(LIST *o)
|
||||
{
|
||||
UINT i;
|
||||
if (o == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0;i < LIST_NUM(o);i++)
|
||||
{
|
||||
char *s = LIST_DATA(o, i);
|
||||
Free(s);
|
||||
}
|
||||
|
||||
ReleaseList(o);
|
||||
}
|
||||
|
||||
// Add a string distinct to the string list
|
||||
bool AddStrToStrListDistinct(LIST *o, char *str)
|
||||
{
|
||||
if (o == NULL || str == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsInListStr(o, str) == false)
|
||||
{
|
||||
Add(o, CopyStr(str));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Examine whether a string items are present in the list
|
||||
bool IsInListStr(LIST *o, char *str)
|
||||
{
|
||||
@ -2948,6 +2990,43 @@ void WriteBufBuf(BUF *b, BUF *bb)
|
||||
WriteBuf(b, bb->Buf, bb->Size);
|
||||
}
|
||||
|
||||
// Write the buffer (from the offset) to a buffer
|
||||
void WriteBufBufWithOffset(BUF *b, BUF *bb)
|
||||
{
|
||||
// Validate arguments
|
||||
if (b == NULL || bb == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WriteBuf(b, ((UCHAR *)bb->Buf) + bb->Current, bb->Size - bb->Current);
|
||||
}
|
||||
|
||||
// Skip UTF-8 BOM
|
||||
bool BufSkipUtf8Bom(BUF *b)
|
||||
{
|
||||
if (b == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SeekBufToBegin(b);
|
||||
|
||||
if (b->Size >= 3)
|
||||
{
|
||||
UCHAR *data = b->Buf;
|
||||
|
||||
if (data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF)
|
||||
{
|
||||
SeekBuf(b, 3, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read into a buffer from the buffer
|
||||
BUF *ReadBufFromBuf(BUF *b, UINT size)
|
||||
{
|
||||
|
@ -208,7 +208,9 @@ BUF *NewBufFromMemory(void *buf, UINT size);
|
||||
void ClearBuf(BUF *b);
|
||||
void WriteBuf(BUF *b, void *buf, UINT size);
|
||||
void WriteBufBuf(BUF *b, BUF *bb);
|
||||
void WriteBufBufWithOffset(BUF *b, BUF *bb);
|
||||
UINT ReadBuf(BUF *b, void *buf, UINT size);
|
||||
bool BufSkipUtf8Bom(BUF *b);
|
||||
BUF *ReadBufFromBuf(BUF *b, UINT size);
|
||||
void AdjustBufSize(BUF *b, UINT new_size);
|
||||
void SeekBuf(BUF *b, UINT offset, int mode);
|
||||
@ -357,5 +359,9 @@ void CleanupSharedBuffer(SHARED_BUFFER *b);
|
||||
void AppendBufUtf8(BUF *b, wchar_t *str);
|
||||
void AppendBufStr(BUF *b, char *str);
|
||||
|
||||
LIST *NewStrList();
|
||||
void ReleaseStrList(LIST *o);
|
||||
bool AddStrToStrListDistinct(LIST *o, char *str);
|
||||
|
||||
#endif // MEMORY_H
|
||||
|
||||
|
@ -7229,6 +7229,12 @@ bool IsIP4(IP *ip)
|
||||
return (IsIP6(ip) ? false : true);
|
||||
}
|
||||
|
||||
// Copy the IP address
|
||||
void CopyIP(IP *dst, IP *src)
|
||||
{
|
||||
Copy(dst, src, sizeof(IP));
|
||||
}
|
||||
|
||||
// Get the number of clients connected from the specified IP address
|
||||
UINT GetNumIpClient(IP *ip)
|
||||
{
|
||||
@ -11368,6 +11374,50 @@ void InitSockSet(SOCKSET *set)
|
||||
Zero(set, sizeof(SOCKSET));
|
||||
}
|
||||
|
||||
// Receive data and discard all of them
|
||||
bool RecvAllWithDiscard(SOCK *sock, UINT size, bool secure)
|
||||
{
|
||||
static UCHAR buffer[4096];
|
||||
UINT recv_size, sz, ret;
|
||||
if (sock == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (size == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (sock->AsyncMode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
recv_size = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
sz = MIN(size - recv_size, sizeof(buffer));
|
||||
ret = Recv(sock, buffer, sz, secure);
|
||||
if (ret == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (ret == SOCK_LATER)
|
||||
{
|
||||
// I suppose that this is safe because the RecvAll() function is used only
|
||||
// if the sock->AsyncMode == true. And the Recv() function may return
|
||||
// SOCK_LATER only if the sock->AsyncMode == false. Therefore the call of
|
||||
// Recv() function in the RecvAll() function never returns SOCK_LATER.
|
||||
return false;
|
||||
}
|
||||
recv_size += ret;
|
||||
if (recv_size >= size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Receive all by TCP
|
||||
bool RecvAll(SOCK *sock, void *data, UINT size, bool secure)
|
||||
{
|
||||
|
@ -953,6 +953,7 @@ UINT GetContentLength(HTTP_HEADER *header);
|
||||
void GetHttpDateStr(char *str, UINT size, UINT64 t);
|
||||
bool HttpSendForbidden(SOCK *s, char *target, char *server_id);
|
||||
bool HttpSendNotFound(SOCK *s, char *target);
|
||||
bool HttpSendBody(SOCK *s, void *data, UINT size, char *contents_type);
|
||||
bool HttpSendNotImplemented(SOCK *s, char *method, char *target, char *version);
|
||||
bool HttpServerSend(SOCK *s, PACK *p);
|
||||
bool HttpClientSend(SOCK *s, PACK *p);
|
||||
@ -1193,6 +1194,7 @@ void SendAdd(SOCK *sock, void *data, UINT size);
|
||||
bool SendNow(SOCK *sock, int secure);
|
||||
bool RecvAll(SOCK *sock, void *data, UINT size, bool secure);
|
||||
bool RecvAllEx(SOCK *sock, void **data_new_ptr, UINT size, bool secure);
|
||||
bool RecvAllWithDiscard(SOCK *sock, UINT size, bool secure);
|
||||
void InitSockSet(SOCKSET *set);
|
||||
void AddSockSet(SOCKSET *set, SOCK *sock);
|
||||
CANCEL *NewCancel();
|
||||
@ -1308,6 +1310,7 @@ void SocketTimeoutThread(THREAD *t, void *param);
|
||||
SOCKET_TIMEOUT_PARAM *NewSocketTimeout(SOCK *sock);
|
||||
void FreeSocketTimeout(SOCKET_TIMEOUT_PARAM *ttp);
|
||||
|
||||
void CopyIP(IP *dst, IP *src);
|
||||
bool IsIP6(IP *ip);
|
||||
bool IsIP4(IP *ip);
|
||||
void IPv6AddrToIP(IP *ip, IPV6_ADDR *addr);
|
||||
|
1006
src/Mayaqua/Pack.c
1006
src/Mayaqua/Pack.c
File diff suppressed because it is too large
Load Diff
@ -55,12 +55,38 @@ struct ELEMENT
|
||||
UINT num_value; // Number of values (>=1)
|
||||
UINT type; // Type
|
||||
VALUE **values; // List of pointers to the value
|
||||
bool JsonHint_IsArray;
|
||||
bool JsonHint_IsBool;
|
||||
bool JsonHint_IsDateTime;
|
||||
bool JsonHint_IsIP;
|
||||
char JsonHint_GroupName[MAX_ELEMENT_NAME_LEN + 1];
|
||||
};
|
||||
|
||||
// PACK object
|
||||
struct PACK
|
||||
{
|
||||
LIST *elements; // Element list
|
||||
LIST *json_subitem_names; // JSON sub-item names
|
||||
char CurrentJsonHint_GroupName[MAX_ELEMENT_NAME_LEN + 1];
|
||||
};
|
||||
|
||||
|
||||
#define MAX_JSONPACK_HINT_ITEMS 64
|
||||
#define JSONPACK_HINT_TYPE_ARRAY 1
|
||||
|
||||
// JSON/PACK converter hint element
|
||||
struct JSONPACKHINT_ITEM
|
||||
{
|
||||
UINT Type;
|
||||
char ArrayNumNameInPack[MAX_ELEMENT_NAME_LEN + 1];
|
||||
char ArrayMembersInPack[MAX_SIZE + 1];
|
||||
};
|
||||
|
||||
// JSON/PACK converter hint
|
||||
struct JSONPACKHINT
|
||||
{
|
||||
UINT NumHints;
|
||||
JSONPACKHINT_ITEM Hints[MAX_JSONPACK_HINT_ITEMS];
|
||||
};
|
||||
|
||||
|
||||
@ -100,21 +126,23 @@ TOKEN_LIST *GetPackElementNames(PACK *p);
|
||||
|
||||
X *PackGetX(PACK *p, char *name);
|
||||
K *PackGetK(PACK *p, char *name);
|
||||
void PackAddX(PACK *p, char *name, X *x);
|
||||
void PackAddK(PACK *p, char *name, K *k);
|
||||
void PackAddStr(PACK *p, char *name, char *str);
|
||||
void PackAddStrEx(PACK *p, char *name, char *str, UINT index, UINT total);
|
||||
void PackAddUniStr(PACK *p, char *name, wchar_t *unistr);
|
||||
void PackAddUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT index, UINT total);
|
||||
void PackAddInt(PACK *p, char *name, UINT i);
|
||||
void PackAddNum(PACK *p, char *name, UINT num);
|
||||
void PackAddIntEx(PACK *p, char *name, UINT i, UINT index, UINT total);
|
||||
void PackAddInt64(PACK *p, char *name, UINT64 i);
|
||||
void PackAddInt64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total);
|
||||
void PackAddData(PACK *p, char *name, void *data, UINT size);
|
||||
void PackAddDataEx(PACK *p, char *name, void *data, UINT size, UINT index, UINT total);
|
||||
void PackAddBuf(PACK *p, char *name, BUF *b);
|
||||
void PackAddBufEx(PACK *p, char *name, BUF *b, UINT index, UINT total);
|
||||
ELEMENT *PackAddX(PACK *p, char *name, X *x);
|
||||
ELEMENT *PackAddK(PACK *p, char *name, K *k);
|
||||
ELEMENT *PackAddStr(PACK *p, char *name, char *str);
|
||||
ELEMENT *PackAddStrEx(PACK *p, char *name, char *str, UINT index, UINT total);
|
||||
ELEMENT *PackAddUniStr(PACK *p, char *name, wchar_t *unistr);
|
||||
ELEMENT *PackAddUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT index, UINT total);
|
||||
ELEMENT *PackAddInt(PACK *p, char *name, UINT i);
|
||||
ELEMENT *PackAddNum(PACK *p, char *name, UINT num);
|
||||
ELEMENT *PackAddIntEx(PACK *p, char *name, UINT i, UINT index, UINT total);
|
||||
ELEMENT *PackAddInt64(PACK *p, char *name, UINT64 i);
|
||||
ELEMENT *PackAddInt64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total);
|
||||
ELEMENT *PackAddTime64(PACK *p, char *name, UINT64 i);
|
||||
ELEMENT *PackAddTime64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total);
|
||||
ELEMENT *PackAddData(PACK *p, char *name, void *data, UINT size);
|
||||
ELEMENT *PackAddDataEx(PACK *p, char *name, void *data, UINT size, UINT index, UINT total);
|
||||
ELEMENT *PackAddBuf(PACK *p, char *name, BUF *b);
|
||||
ELEMENT *PackAddBufEx(PACK *p, char *name, BUF *b, UINT index, UINT total);
|
||||
bool PackGetStr(PACK *p, char *name, char *str, UINT size);
|
||||
bool PackGetStrEx(PACK *p, char *name, char *str, UINT size, UINT index);
|
||||
bool PackGetUniStr(PACK *p, char *name, wchar_t *unistr, UINT size);
|
||||
@ -133,23 +161,38 @@ bool PackGetDataEx(PACK *p, char *name, void *data, UINT index);
|
||||
BUF *PackGetBuf(PACK *p, char *name);
|
||||
BUF *PackGetBufEx(PACK *p, char *name, UINT index);
|
||||
bool PackGetBool(PACK *p, char *name);
|
||||
void PackAddBool(PACK *p, char *name, bool b);
|
||||
void PackAddBoolEx(PACK *p, char *name, bool b, UINT index, UINT total);
|
||||
ELEMENT *PackAddBool(PACK *p, char *name, bool b);
|
||||
ELEMENT *PackAddBoolEx(PACK *p, char *name, bool b, UINT index, UINT total);
|
||||
bool PackGetBoolEx(PACK *p, char *name, UINT index);
|
||||
void PackAddIp(PACK *p, char *name, IP *ip);
|
||||
void PackAddIpEx(PACK *p, char *name, IP *ip, UINT index, UINT total);
|
||||
void PackAddIpEx2(PACK *p, char *name, IP *ip, UINT index, UINT total, bool is_single);
|
||||
bool PackGetIp(PACK *p, char *name, IP *ip);
|
||||
bool PackGetIpEx(PACK *p, char *name, IP *ip, UINT index);
|
||||
UINT PackGetIp32(PACK *p, char *name);
|
||||
UINT PackGetIp32Ex(PACK *p, char *name, UINT index);
|
||||
void PackAddIp32(PACK *p, char *name, UINT ip32);
|
||||
void PackAddIp32Ex(PACK *p, char *name, UINT ip32, UINT index, UINT total);
|
||||
void PackAddIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index, UINT total);
|
||||
void PackAddIp32Ex2(PACK *p, char *name, UINT ip32, UINT index, UINT total, bool is_single);
|
||||
ELEMENT *PackAddIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index, UINT total);
|
||||
bool PackGetIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index);
|
||||
void PackAddIp6Addr(PACK *p, char *name, IPV6_ADDR *addr);
|
||||
ELEMENT *PackAddIp6Addr(PACK *p, char *name, IPV6_ADDR *addr);
|
||||
bool PackGetIp6Addr(PACK *p, char *name, IPV6_ADDR *addr);
|
||||
bool PackGetData2(PACK *p, char *name, void *data, UINT size);
|
||||
bool PackGetDataEx2(PACK *p, char *name, void *data, UINT size, UINT index);
|
||||
bool PackIsValueExists(PACK *p, char *name);
|
||||
void PackSetCurrentJsonGroupName(PACK *p, char *json_group_name);
|
||||
ELEMENT *ElementNullSafe(ELEMENT *p);
|
||||
|
||||
JSON_VALUE *PackToJson(PACK *p);
|
||||
char *PackToJsonStr(PACK *p);
|
||||
|
||||
PACK *JsonToPack(JSON_VALUE *v);
|
||||
PACK *JsonStrToPack(char *str);
|
||||
|
||||
void PackArrayElementToJsonArray(JSON_ARRAY *ja, PACK *p, ELEMENT *e, UINT index);
|
||||
void PackElementToJsonObject(JSON_OBJECT *o, PACK *p, ELEMENT *e, UINT index);
|
||||
char *DetermineJsonSuffixForPackElement(ELEMENT *e);
|
||||
bool JsonTryParseValueAddToPack(PACK *p, JSON_VALUE *v, char *v_name, UINT index, UINT total, bool is_single);
|
||||
|
||||
#endif // PACK_H
|
||||
|
2116
src/Mayaqua/Str.c
2116
src/Mayaqua/Str.c
File diff suppressed because it is too large
Load Diff
@ -79,7 +79,9 @@ void BinToStrW(wchar_t *str, UINT str_size, void *data, UINT data_size);
|
||||
void PrintBin(void *data, UINT size);
|
||||
bool StartWith(char *str, char *key);
|
||||
bool EndWith(char *str, char *key);
|
||||
bool TrimEndWith(char *dst, UINT dst_size, char *str, char *key);
|
||||
UINT64 ToInt64(char *str);
|
||||
UINT64 Json_ToInt64Ex(char *str, char **endptr, bool *error);
|
||||
void ToStr64(char *str, UINT64 value);
|
||||
TOKEN_LIST *ParseCmdLine(char *str);
|
||||
TOKEN_LIST *CopyToken(TOKEN_LIST *src);
|
||||
@ -128,6 +130,259 @@ LIST *StrToIntList(char *str, bool sorted);
|
||||
void NormalizeIntListStr(char *dst, UINT dst_size, char *src, bool sorted, char *separate_str);
|
||||
void ClearStr(char *str, UINT str_size);
|
||||
void SetStrCaseAccordingToBits(char *str, UINT bits);
|
||||
char *UrlDecode(char *url_str);
|
||||
|
||||
|
||||
// *** JSON strings support
|
||||
// Original source code from Parson ( http://kgabis.github.com/parson/ )
|
||||
// Modified by dnobori
|
||||
/*
|
||||
Parson ( http://kgabis.github.com/parson/ )
|
||||
Copyright (c) 2012 - 2017 Krzysztof Gabis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/* Type definitions */
|
||||
typedef union JSON_VALUE_UNION {
|
||||
char *string;
|
||||
UINT64 number;
|
||||
JSON_OBJECT *object;
|
||||
JSON_ARRAY *array;
|
||||
int boolean;
|
||||
int null;
|
||||
} JSON_VALUE_UNION;
|
||||
|
||||
struct JSON_VALUE {
|
||||
JSON_VALUE *parent;
|
||||
UINT type;
|
||||
JSON_VALUE_UNION value;
|
||||
};
|
||||
|
||||
struct JSON_OBJECT {
|
||||
JSON_VALUE *wrapping_value;
|
||||
char **names;
|
||||
JSON_VALUE **values;
|
||||
UINT count;
|
||||
UINT capacity;
|
||||
};
|
||||
|
||||
struct JSON_ARRAY {
|
||||
JSON_VALUE *wrapping_value;
|
||||
JSON_VALUE **items;
|
||||
UINT count;
|
||||
UINT capacity;
|
||||
};
|
||||
|
||||
|
||||
enum JSON_TYPES {
|
||||
JSON_TYPE_ERROR = -1,
|
||||
JSON_TYPE_NULL = 1,
|
||||
JSON_TYPE_STRING = 2,
|
||||
JSON_TYPE_NUMBER = 3,
|
||||
JSON_TYPE_OBJECT = 4,
|
||||
JSON_TYPE_ARRAY = 5,
|
||||
JSON_TYPE_BOOL = 6
|
||||
};
|
||||
typedef unsigned int UINT;
|
||||
|
||||
enum JSON_RETS {
|
||||
JSON_RET_OK = 0,
|
||||
JSON_RET_ERROR = -1
|
||||
};
|
||||
|
||||
typedef void * (*JSON_Malloc_Function)(UINT);
|
||||
typedef void(*JSON_Free_Function)(void *);
|
||||
|
||||
/* Call only once, before calling any other function from parson API. If not called, malloc and free
|
||||
from stdlib will be used for all allocations */
|
||||
void JsonSetAllocationFunctions(JSON_Malloc_Function malloc_fun, JSON_Free_Function free_fun);
|
||||
|
||||
/* Parses first JSON value in a string, returns NULL in case of error */
|
||||
JSON_VALUE * JsonParseString(char *string);
|
||||
|
||||
/* Parses first JSON value in a string and ignores comments (/ * * / and //),
|
||||
returns NULL in case of error */
|
||||
JSON_VALUE * JsonParseStringWithComments(char *string);
|
||||
|
||||
/* Serialization */
|
||||
UINT JsonGetSerializationSize(JSON_VALUE *value); /* returns 0 on fail */
|
||||
UINT JsonSerializeToBuffer(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes);
|
||||
char * JsonSerializeToString(JSON_VALUE *value);
|
||||
|
||||
/* Pretty serialization */
|
||||
UINT JsonGetSerializationSizePretty(JSON_VALUE *value); /* returns 0 on fail */
|
||||
UINT JsonSerializeToBufferPretty(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes);
|
||||
char * JsonSerializeToStringPretty(JSON_VALUE *value);
|
||||
char *JsonToStr(JSON_VALUE *v);
|
||||
|
||||
void JsonFreeString(char *string); /* frees string from json_serialize_to_string and json_serialize_to_string_pretty */
|
||||
|
||||
/* Comparing */
|
||||
int JsonCmp(JSON_VALUE *a, JSON_VALUE *b);
|
||||
|
||||
/* Validation
|
||||
This is *NOT* JSON Schema. It validates json by checking if object have identically
|
||||
named fields with matching types.
|
||||
For example schema {"name":"", "age":0} will validate
|
||||
{"name":"Joe", "age":25} and {"name":"Joe", "age":25, "gender":"m"},
|
||||
but not {"name":"Joe"} or {"name":"Joe", "age":"Cucumber"}.
|
||||
In case of arrays, only first value in schema is checked against all values in tested array.
|
||||
Empty objects ({}) validate all objects, empty arrays ([]) validate all arrays,
|
||||
null validates values of every type.
|
||||
*/
|
||||
UINT JsonValidate(JSON_VALUE *schema, JSON_VALUE *value);
|
||||
|
||||
/*
|
||||
* JSON Object
|
||||
*/
|
||||
JSON_VALUE * JsonGet(JSON_OBJECT *object, char *name);
|
||||
char * JsonGetStr(JSON_OBJECT *object, char *name);
|
||||
JSON_OBJECT * JsonGetObj(JSON_OBJECT *object, char *name);
|
||||
JSON_ARRAY * JsonGetArray(JSON_OBJECT *object, char *name);
|
||||
UINT64 JsonGetNumber(JSON_OBJECT *object, char *name); /* returns 0 on fail */
|
||||
bool JsonGetBool(JSON_OBJECT *object, char *name); /* returns 0 on fail */
|
||||
|
||||
/* dotget functions enable addressing values with dot notation in nested objects,
|
||||
just like in structs or c++/java/c# objects (e.g. objectA.objectB.value).
|
||||
Because valid names in JSON can contain dots, some values may be inaccessible
|
||||
this way. */
|
||||
JSON_VALUE * JsonDotGet(JSON_OBJECT *object, char *name);
|
||||
char * JsonDotGetStr(JSON_OBJECT *object, char *name);
|
||||
JSON_OBJECT * JsonDotGetObj(JSON_OBJECT *object, char *name);
|
||||
JSON_ARRAY * JsonDotGetArray(JSON_OBJECT *object, char *name);
|
||||
UINT64 JsonDotGetNumber(JSON_OBJECT *object, char *name); /* returns 0 on fail */
|
||||
bool JsonDotGetBool(JSON_OBJECT *object, char *name); /* returns -1 on fail */
|
||||
|
||||
/* Functions to get available names */
|
||||
UINT JsonGetCount(JSON_OBJECT *object);
|
||||
char * JsonGetName(JSON_OBJECT *object, UINT index);
|
||||
JSON_VALUE * JsonGetValueAt(JSON_OBJECT *object, UINT index);
|
||||
JSON_VALUE * JsonGetWrappingValue(JSON_OBJECT *object);
|
||||
|
||||
/* Functions to check if object has a value with a specific name. Returned value is 1 if object has
|
||||
* a value and 0 if it doesn't. dothas functions behave exactly like dotget functions. */
|
||||
int JsonIsExists(JSON_OBJECT *object, char *name);
|
||||
int JsonIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type);
|
||||
|
||||
int JsonDotIsExists(JSON_OBJECT *object, char *name);
|
||||
int JsonDotIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type);
|
||||
|
||||
/* Creates new name-value pair or frees and replaces old value with a new one.
|
||||
* json_object_set_value does not copy passed value so it shouldn't be freed afterwards. */
|
||||
UINT JsonSet(JSON_OBJECT *object, char *name, JSON_VALUE *value);
|
||||
UINT JsonSetStr(JSON_OBJECT *object, char *name, char *string);
|
||||
UINT JsonSetUniStr(JSON_OBJECT *object, char *name, wchar_t *string);
|
||||
UINT JsonSetNumber(JSON_OBJECT *object, char *name, UINT64 number);
|
||||
UINT JsonSetBool(JSON_OBJECT *object, char *name, int boolean);
|
||||
UINT JsonSetNull(JSON_OBJECT *object, char *name);
|
||||
UINT JsonSetData(JSON_OBJECT *object, char *name, void *data, UINT size);
|
||||
|
||||
/* Works like dotget functions, but creates whole hierarchy if necessary.
|
||||
* json_object_dotset_value does not copy passed value so it shouldn't be freed afterwards. */
|
||||
UINT JsonDotSet(JSON_OBJECT *object, char *name, JSON_VALUE *value);
|
||||
UINT JsonDotSetStr(JSON_OBJECT *object, char *name, char *string);
|
||||
UINT JsonDotSetNumber(JSON_OBJECT *object, char *name, UINT64 number);
|
||||
UINT JsonDotSetBool(JSON_OBJECT *object, char *name, int boolean);
|
||||
UINT JsonDotSetNull(JSON_OBJECT *object, char *name);
|
||||
|
||||
/* Frees and removes name-value pair */
|
||||
UINT JsonDelete(JSON_OBJECT *object, char *name);
|
||||
|
||||
/* Works like dotget function, but removes name-value pair only on exact match. */
|
||||
UINT JsonDotDelete(JSON_OBJECT *object, char *key);
|
||||
|
||||
/* Removes all name-value pairs in object */
|
||||
UINT JsonDeleteAll(JSON_OBJECT *object);
|
||||
|
||||
/*
|
||||
*JSON Array
|
||||
*/
|
||||
JSON_VALUE * JsonArrayGet(JSON_ARRAY *array, UINT index);
|
||||
char * JsonArrayGetStr(JSON_ARRAY *array, UINT index);
|
||||
JSON_OBJECT * JsonArrayGetObj(JSON_ARRAY *array, UINT index);
|
||||
JSON_ARRAY * JsonArrayGetArray(JSON_ARRAY *array, UINT index);
|
||||
UINT64 JsonArrayGetNumber(JSON_ARRAY *array, UINT index); /* returns 0 on fail */
|
||||
bool JsonArrayGetBool(JSON_ARRAY *array, UINT index); /* returns 0 on fail */
|
||||
UINT JsonArrayGetCount(JSON_ARRAY *array);
|
||||
JSON_VALUE * JsonArrayGetWrappingValue(JSON_ARRAY *array);
|
||||
|
||||
/* Frees and removes value at given index, does nothing and returns JSONFailure if index doesn't exist.
|
||||
* Order of values in array may change during execution. */
|
||||
UINT JsonArrayDelete(JSON_ARRAY *array, UINT i);
|
||||
|
||||
/* Frees and removes from array value at given index and replaces it with given one.
|
||||
* Does nothing and returns JSONFailure if index doesn't exist.
|
||||
* json_array_replace_value does not copy passed value so it shouldn't be freed afterwards. */
|
||||
UINT JsonArrayReplace(JSON_ARRAY *array, UINT i, JSON_VALUE *value);
|
||||
UINT JsonArrayReplaceStr(JSON_ARRAY *array, UINT i, char* string);
|
||||
UINT JsonArrayReplaceNumber(JSON_ARRAY *array, UINT i, UINT64 number);
|
||||
UINT JsonArrayReplaceBool(JSON_ARRAY *array, UINT i, int boolean);
|
||||
UINT JsonArrayReplaceNull(JSON_ARRAY *array, UINT i);
|
||||
|
||||
/* Frees and removes all values from array */
|
||||
UINT JsonArrayDeleteAll(JSON_ARRAY *array);
|
||||
|
||||
/* Appends new value at the end of array.
|
||||
* json_array_append_value does not copy passed value so it shouldn't be freed afterwards. */
|
||||
UINT JsonArrayAdd(JSON_ARRAY *array, JSON_VALUE *value);
|
||||
UINT JsonArrayAddStr(JSON_ARRAY *array, char *string);
|
||||
UINT JsonArrayAddUniStr(JSON_ARRAY *array, wchar_t *string);
|
||||
UINT JsonArrayAddNumber(JSON_ARRAY *array, UINT64 number);
|
||||
UINT JsonArrayAddData(JSON_ARRAY *array, void *data, UINT size);
|
||||
UINT JsonArrayAddBool(JSON_ARRAY *array, int boolean);
|
||||
UINT JsonArrayAddNull(JSON_ARRAY *array);
|
||||
|
||||
|
||||
/*
|
||||
*JSON Value
|
||||
*/
|
||||
JSON_VALUE * JsonNewObject(void);
|
||||
JSON_VALUE * JsonNewArray(void);
|
||||
JSON_VALUE * JsonNewStr(char *string); /* copies passed string */
|
||||
JSON_VALUE * JsonNewNumber(UINT64 number);
|
||||
JSON_VALUE * JsonNewBool(int boolean);
|
||||
JSON_VALUE * JsonNewNull(void);
|
||||
JSON_VALUE * JsonDeepCopy(JSON_VALUE *value);
|
||||
void JsonFree(JSON_VALUE *value);
|
||||
|
||||
UINT JsonValueGetType(JSON_VALUE *value);
|
||||
JSON_OBJECT * JsonValueGetObject(JSON_VALUE *value);
|
||||
JSON_ARRAY * JsonValueGetArray(JSON_VALUE *value);
|
||||
char * JsonValueGetStr(JSON_VALUE *value);
|
||||
UINT64 JsonValueGetNumber(JSON_VALUE *value);
|
||||
bool JsonValueGetBool(JSON_VALUE *value);
|
||||
JSON_VALUE * JsonValueGetParent(JSON_VALUE *value);
|
||||
|
||||
/* Same as above, but shorter */
|
||||
UINT JsonType(JSON_VALUE *value);
|
||||
JSON_OBJECT * JsonObject(JSON_VALUE *value);
|
||||
JSON_ARRAY * JsonArray(JSON_VALUE *value);
|
||||
char * JsonString(JSON_VALUE *value);
|
||||
UINT64 JsonNumber(JSON_VALUE *value);
|
||||
int JsonBool(JSON_VALUE *value);
|
||||
|
||||
void SystemTimeToJsonStr(char *dst, UINT size, SYSTEMTIME *t);
|
||||
void SystemTime64ToJsonStr(char *dst, UINT size, UINT64 t);
|
||||
|
||||
JSON_VALUE *StrToJson(char *str);
|
||||
|
||||
#endif // STR_H
|
||||
|
||||
|
@ -157,11 +157,11 @@ ERR_91 无法断开虚拟 3 层交换机会话。要删除会话,请停
|
||||
ERR_92 具有指定名称的虚拟 3 层交换机已存在。指定一个不同的名称。
|
||||
ERR_93 找不到指定的虚拟 3 层交换机。
|
||||
ERR_94 指定的名称无效。检查名称是否有不能使用的字符
|
||||
ERR_95 无法添加虚拟 3 层接口。
|
||||
ERR_96 无法删除虚拟 3 层接口。
|
||||
ERR_95 无法添加虚拟 3 层接口。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_96 无法删除虚拟 3 层接口。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_97 与指定虚拟 3 层交换接口的目标虚拟 HUB 连接的虚拟 3 层接口已在虚拟 3 层交换机中存在。不能在同一个虚拟 3 层交换机中定义超过一个连接到同一个虚拟 HUB 的虚拟 3 层接口。
|
||||
ERR_98 无法添加路由表项。
|
||||
ERR_99 无法删除路由表项。
|
||||
ERR_98 无法添加路由表项。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_99 无法删除路由表项。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_100 指定的路由表项已存在。
|
||||
ERR_101 客户端和服务器的时钟彼此不同步。检查时间设置。
|
||||
ERR_102 无法启动此虚拟 3 层交换机。 要启动虚拟 3 层交换机,必须在虚拟 3 层交换机定义至少一个虚拟接口。
|
||||
@ -1805,6 +1805,9 @@ LS_LICENSE_NOT_VPNSERVER 连接 "%S": 许可证错误。VPN Client 尝试连接
|
||||
LS_LICENSE_NOT_VPNCLUSTER 连接 "%S": 许可证错误。此 VPN Server 上注册的许可证是禁止使用当前群集功能的类型,且一个 VPN Client 已尝试在群集模式下连接。您必须重启 VPN Server。
|
||||
LS_LICENSE_VIOLATION 连接 "%S": VPN Server 发生违反许可证错误,不接受连接。
|
||||
LS_LICENSE_VIOLATION_DETECTED 发现许可证违反错误,一个不同的 VPN Server 与此服务端具有相同的服务端ID "%I64u"。可能是在群集中有两个或以上 VPN Server 正在使用相同的许可证。请检查每一个 VPN Server 的许可证信息。
|
||||
LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s"
|
||||
|
||||
|
||||
# (OpenVPN Logs)
|
||||
|
@ -158,11 +158,11 @@ ERR_91 Unable to disconnect the Virtual Layer 3 Switch session. To delete th
|
||||
ERR_92 A Virtual Layer 3 Switch with the specified name already exists. Specify a different name.
|
||||
ERR_93 Specified Virtual Layer 3 Switch not found.
|
||||
ERR_94 The specified name is invalid. Check if the name contains characters that cannot be used.
|
||||
ERR_95 Failed to add the Virtual Layer 3 interface.
|
||||
ERR_96 Failed to delete the Virtual Layer 3 interface.
|
||||
ERR_95 Failed to add the Virtual Layer 3 interface. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_96 Failed to delete the Virtual Layer 3 interface. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_97 The Virtual Layer 3 interface that is connecting to the destination Virtual Hub of the specified Virtual Layer 3 interface already exists in the Virtual Layer 3 Switch. No more than one Virtual Layer 3 interface that connects to the same Virtual Hub can be defined in a Virtual Layer 3 Switch.
|
||||
ERR_98 Failed to add routing table entry.
|
||||
ERR_99 Failed to delete routing table entry.
|
||||
ERR_98 Failed to add routing table entry. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_99 Failed to delete routing table entry. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_100 The specified routing table entry already exists.
|
||||
ERR_101 The client clock and the server clock are not synchronized with each other. Check the time settings.
|
||||
ERR_102 Unable to start this Virtual Layer 3 Switch. \r\n\r\nTo start the Virtual Layer 3 Switch, at least 1 virtual interface must be defined in the Virtual Layer 3 Switch.
|
||||
@ -1788,7 +1788,9 @@ LS_LICENSE_NOT_VPNSERVER Connection "%S": License error occurred. The VPN Client
|
||||
LS_LICENSE_NOT_VPNCLUSTER Connection "%S": License error occurred. The license registered on this VPN Server is of a type that prevents the use of the current clustering function and a VPN Client has attempted connection while operating in Cluster mode. You must restart the VPN Server.
|
||||
LS_LICENSE_VIOLATION Connection "%S": A license violation has occurred on the VPN Server and connections are not being received.
|
||||
LS_LICENSE_VIOLATION_DETECTED A license violation has been detected. A different VPN Server is operating with the same server ID "%I64u" as this VPN Server. It is possible that there are two or more VPN Servers in the cluster that are using the same license. Check the license information of each VPN Server.
|
||||
|
||||
LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s"
|
||||
|
||||
# (OpenVPN Logs)
|
||||
LO_PREFIX_RAW OpenVPN Module:
|
||||
|
@ -160,11 +160,11 @@ ERR_91 仮想レイヤ 3 スイッチセッションは切断できません
|
||||
ERR_92 指定された名前の仮想レイヤ 3 スイッチは既に存在します。別の名前を指定してください。
|
||||
ERR_93 指定された名前の仮想レイヤ 3 スイッチが見つかりません。
|
||||
ERR_94 指定された名前が不正です。使用できない文字が含まれていないかどうかチェックしてください。
|
||||
ERR_95 仮想レイヤ 3 インターフェイスの追加に失敗しました。
|
||||
ERR_96 仮想レイヤ 3 インターフェイスの削除に失敗しました。
|
||||
ERR_95 仮想レイヤ 3 インターフェイスの追加に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、仮想レイヤ 3 インターフェイスの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。
|
||||
ERR_96 仮想レイヤ 3 インターフェイスの削除に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、仮想レイヤ 3 インターフェイスの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。
|
||||
ERR_97 指定された仮想レイヤ 3 インターフェイスの接続先仮想 HUB に接続している仮想レイヤ 3 インターフェイスが仮想レイヤ 3 スイッチの中に既に存在します。1 つの仮想レイヤ 3 スイッチの中では、同一の仮想 HUB に接続する仮想レイヤ 3 インターフェイスは 1 つしか定義できません。
|
||||
ERR_98 ルーティングテーブルの追加に失敗しました。
|
||||
ERR_99 ルーティングテーブルの削除に失敗しました。
|
||||
ERR_98 ルーティングテーブルの追加に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、ルーティングテーブルの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。
|
||||
ERR_99 ルーティングテーブルの削除に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、ルーティングテーブルの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。
|
||||
ERR_100 指定されたルーティングテーブルはすでに存在します。
|
||||
ERR_101 クライアントとサーバーの間の時計がずれています。時刻設定を確認してください。
|
||||
ERR_102 この仮想レイヤ 3 スイッチを開始できません。\r\n\r\n仮想レイヤ 3 スイッチを開始するには、最低でも 1 つの仮想インターフェイスが仮想レイヤ 3 スイッチ内に定義されている必要があります。
|
||||
@ -1792,7 +1792,9 @@ LS_LICENSE_NOT_VPNSERVER コネクション "%S": ライセンスエラーが発
|
||||
LS_LICENSE_NOT_VPNCLUSTER コネクション "%S": ライセンスエラーが発生しました。この VPN Server には現在クラスタリング機能を使用できない種類のライセンスが登録されていますが、クラスタモードで動作中に VPN Client が接続しようとしました。VPN Server を再起動する必要があります。
|
||||
LS_LICENSE_VIOLATION コネクション "%S": VPN Server でライセンス違反が発生しているため、接続を受け付けられません。
|
||||
LS_LICENSE_VIOLATION_DETECTED ライセンス違反を検出しました。別の VPN Server が、この VPN Server と同じサーバー ID "%I64u" で動作しています。クラスタ内に同一のライセンスを使用した 2 台以上の VPN Server が存在する可能性があります。各 VPN Server のライセンス情報を確認してください。
|
||||
|
||||
LS_API_AUTH_OK HTTPS API クライアント "%r:%u" (%S): 管理モード: "%S" で組み込み HTTPS Web サーバーを用いてログインに成功しました。使用されたユーザー名: "%S", メソッド: "%S", パス: "%S"
|
||||
LS_API_AUTH_ERROR HTTPS API クライアント "%r:%u" (%S): 組み込み HTTPS Web サーバーを用いてログインに失敗しました。使用されたユーザー名: "%S", メソッド: "%S", パス: "%S"
|
||||
LS_API_RPC_CALL HTTPS API クライアント "%r:%u" (%S): JSON-API を呼び出しました。メソッド名: "%S", 結果エラーコード: %u (0 = 成功), 結果エラーメッセージ: "%s"
|
||||
|
||||
# (OpenVPN ログ)
|
||||
LO_PREFIX_RAW OpenVPN モジュール:
|
||||
|
@ -164,11 +164,11 @@ ERR_91 가상 레이어 3 스위치 연결이 끊어 수 없습니다. 세션을
|
||||
ERR_92 지정된 이름의 가상 레이어 3 스위치는 이미 존재합니다. 다른 이름을 지정하십시오.
|
||||
ERR_93 지정된 이름의 가상 레이어 3 스위치가 없습니다.
|
||||
ERR_94 지정된 이름이 잘못되었습니다. 사용할 수없는 문자가 포함되어 있는지 확인하십시오.
|
||||
ERR_95 가상 레이어 3 인터페이스의 추가에 실패했습니다.
|
||||
ERR_96 가상 레이어 3 인터페이스의 삭제에 실패했습니다.
|
||||
ERR_95 가상 레이어 3 인터페이스의 추가에 실패했습니다. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_96 가상 레이어 3 인터페이스의 삭제에 실패했습니다. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_97 지정된 가상 레이어 3 인터페이스가 연결된 가상 HUB에 연결하는 가상 레이어 3 인터페이스가 가상 레이어 3 스위치에 이미 존재합니다. 하나의 가상 레이어 3 스위치에서 동일한 가상 HUB에 연결하는 가상 레이어 3 인터페이스는 하나 밖에 정의 할 수 없습니다.
|
||||
ERR_98 라우팅 테이블 추가에 실패했습니다.
|
||||
ERR_99 라우팅 테이블의 삭제에 실패했습니다.
|
||||
ERR_98 라우팅 테이블 추가에 실패했습니다. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_99 라우팅 테이블의 삭제에 실패했습니다. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_100 지정된 라우팅 테이블이 이미 존재합니다.
|
||||
ERR_101 클라이언트와 서버 사이의 시계가 어긋나 있습니다. 시간 설정을 확인하십시오.
|
||||
ERR_102 이 가상 레이어 3 스위치를 시작할 수 없습니다. \r\n\r\n 가상 레이어 3 스위치를 시작하려면 최소한 1 개의 가상 인터페이스가 가상 레이어 3 스위치에 정의되어 있어야합니다.
|
||||
@ -1773,6 +1773,9 @@ LS_LICENSE_NOT_VPNSERVER 연결 "%S": 라이센스 오류가 발생했습니다.
|
||||
LS_LICENSE_NOT_VPNCLUSTER 연결 "%S": 라이센스 오류가 발생했습니다. 이 VPN Server는 현재 클러스터링 기능을 사용할 수없는 종류의 라이센스가 등록되어 있지만 클러스터 모드로 실행 중에 VPN Client가 연결을 시도했습니다. VPN Server를 다시 시작해야합니다.
|
||||
LS_LICENSE_VIOLATION 연결 "%S": VPN Server에서 라이센스 위반이 발생하고 있기 때문에 연결을 받아 들일 수 없습니다.
|
||||
LS_LICENSE_VIOLATION_DETECTED 라이센스 위반을 감지했습니다. 다른 VPN Server가 이 VPN Server와 동일한 서버 ID "%I64u"으로 동작합니다. 클러스터에 동일한 라이센스를 사용하여 두 개 이상의 VPN Server가 있을 수 있습니다. 각 VPN Server의 라이센스 정보를 확인하십시오.
|
||||
LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s"
|
||||
|
||||
|
||||
# (OpenVPN 로그)
|
||||
|
@ -158,11 +158,11 @@ ERR_91 Unable to disconnect the Virtual Layer 3 Switch session. To delete th
|
||||
ERR_92 A Virtual Layer 3 Switch with the specified name already exists. Specify a different name.
|
||||
ERR_93 Specified Virtual Layer 3 Switch not found.
|
||||
ERR_94 The specified name is invalid. Check if the name contains characters that cannot be used.
|
||||
ERR_95 Failed to add the Virtual Layer 3 interface.
|
||||
ERR_96 Failed to delete the Virtual Layer 3 interface.
|
||||
ERR_95 Failed to add the Virtual Layer 3 interface. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_96 Failed to delete the Virtual Layer 3 interface. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_97 The Virtual Layer 3 interface that is connecting to the destination Virtual Hub of the specified Virtual Layer 3 interface already exists in the Virtual Layer 3 Switch. No more than one Virtual Layer 3 interface that connects to the same Virtual Hub can be defined in a Virtual Layer 3 Switch.
|
||||
ERR_98 Failed to add routing table entry.
|
||||
ERR_99 Failed to delete routing table entry.
|
||||
ERR_98 Failed to add routing table entry. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_99 Failed to delete routing table entry. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_100 The specified routing table entry already exists.
|
||||
ERR_101 The client clock and the server clock are not synchronized with each other. Check the time settings.
|
||||
ERR_102 Unable to start this Virtual Layer 3 Switch. \r\n\r\nTo start the Virtual Layer 3 Switch, at least 1 virtual interface must be defined in the Virtual Layer 3 Switch.
|
||||
@ -1788,6 +1788,9 @@ LS_LICENSE_NOT_VPNSERVER Connection "%S": License error occurred. The VPN Client
|
||||
LS_LICENSE_NOT_VPNCLUSTER Connection "%S": License error occurred. The license registered on this VPN Server is of a type that prevents the use of the current clustering function and a VPN Client has attempted connection while operating in Cluster mode. You must restart the VPN Server.
|
||||
LS_LICENSE_VIOLATION Connection "%S": A license violation has occurred on the VPN Server and connections are not being received.
|
||||
LS_LICENSE_VIOLATION_DETECTED A license violation has been detected. A different VPN Server is operating with the same server ID "%I64u" as this VPN Server. It is possible that there are two or more VPN Servers in the cluster that are using the same license. Check the license information of each VPN Server.
|
||||
LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s"
|
||||
|
||||
|
||||
# (OpenVPN Logs)
|
||||
|
@ -161,11 +161,11 @@ ERR_91 無法斷開虛擬 3 層交換機會話。要刪除會話,請停止
|
||||
ERR_92 具有指定名稱的虛擬 3 層交換機已存在。指定一個不同的名稱。
|
||||
ERR_93 找不到指定的虛擬 3 層交換機。
|
||||
ERR_94 指定的名稱無效。檢查名稱是否有不能使用的字元
|
||||
ERR_95 無法添加虛擬 3 層介面。
|
||||
ERR_96 無法刪除虛擬 3 層介面。
|
||||
ERR_95 無法添加虛擬 3 層介面。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_96 無法刪除虛擬 3 層介面。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_97 與指定虛擬 3 層交換介面的目標虛擬 HUB 連接的虛擬 3 層介面已在虛擬 3 層交換機中存在。不能在同一個虛擬 3 層交換機中定義超過一個連接到同一個虛擬 HUB 的虛擬 3 層介面。
|
||||
ERR_98 無法添加路由表項。
|
||||
ERR_99 無法刪除路由表項。
|
||||
ERR_98 無法添加路由表項。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_99 無法刪除路由表項。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running.
|
||||
ERR_100 指定的路由表項已存在。
|
||||
ERR_101 用戶端和伺服器的時鐘彼此不同步。檢查時間設置。
|
||||
ERR_102 無法啟動此虛擬 3 層交換機。 要啟動虛擬 3 層交換機,必須在虛擬 3 層交換機定義至少一個虛擬介面。
|
||||
@ -1808,6 +1808,9 @@ LS_LICENSE_NOT_VPNSERVER 連接 "%S": 許可證錯誤。VPN Client 嘗試連接
|
||||
LS_LICENSE_NOT_VPNCLUSTER 連接 "%S": 許可證錯誤。此 VPN Server 上註冊的許可證是禁止使用當前群集功能的類型,且一個 VPN Client 已嘗試在群集模式下連接。您必須重啟 VPN Server。
|
||||
LS_LICENSE_VIOLATION 連接 "%S": VPN Server 發生違反許可證錯誤,不接受連接。
|
||||
LS_LICENSE_VIOLATION_DETECTED 發現許可證違反錯誤,一個不同的 VPN Server 與此服務端具有相同的服務端ID "%I64u"。可能是在群集中有兩個或以上 VPN Server 正在使用相同的許可證。請檢查每一個 VPN Server 的許可證資訊。
|
||||
LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S"
|
||||
LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s"
|
||||
|
||||
|
||||
# (OpenVPN Logs)
|
||||
|
14648
src/bin/hamcore/vpnserver_api_doc.html
Normal file
14648
src/bin/hamcore/vpnserver_api_doc.html
Normal file
File diff suppressed because it is too large
Load Diff
22
src/bin/hamcore/wwwroot/admin/README.md
Normal file
22
src/bin/hamcore/wwwroot/admin/README.md
Normal file
@ -0,0 +1,22 @@
|
||||
# About "admin" directory (for developers)
|
||||
This `bin/hamcore/wwwroot/admin/` directory is the web contents root of the embedded HTML5 web administration console: `http://<vpn_server_host>:<port>/admin/`.
|
||||
|
||||
Currently there is only the `default/` sub directory. It is corresponding to `http://<vpn_server_host>:<port>/admin/default/`.
|
||||
|
||||
|
||||
The `/admin/index.html` file always redirects all clients to the `/admin/default/`.
|
||||
|
||||
|
||||
If you are willing to develop the web-based administration console you have two choices:
|
||||
|
||||
1. Modify and improve the `/admin/default/` project.
|
||||
|
||||
|
||||
2. Create your entirely new web project in the `/admin/NEW_PATH_HERE/` directory. You can choose the unique directory name instead of `NEW_PATH_HERE` on the above directory path.
|
||||
|
||||
|
||||
If you want to create an independent new web project, the choice #2 is the best way. You can do anything freely in your new directory. In such a case, please edit the `/admin/index.html` not to redirect to the `/admin/default/index.html` automatically. Instead, put the list of the systems for each of sub directories in the `/admin/index.html` so that the user can choose which system to use.
|
||||
|
||||
|
||||
|
||||
|
1
src/bin/hamcore/wwwroot/admin/default/.gitignore
vendored
Normal file
1
src/bin/hamcore/wwwroot/admin/default/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
16
src/bin/hamcore/wwwroot/admin/default/.vscode/launch.json
vendored
Normal file
16
src/bin/hamcore/wwwroot/admin/default/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"trace": true,
|
||||
"sourceMaps": true,
|
||||
"name": "Launch Chrome",
|
||||
"preLaunchTask": "webpack build",
|
||||
"file": "${workspaceFolder}/index.html",
|
||||
"webRoot": "${workspaceFolder}",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
}
|
||||
]
|
||||
}
|
5
src/bin/hamcore/wwwroot/admin/default/.vscode/settings.json
vendored
Normal file
5
src/bin/hamcore/wwwroot/admin/default/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"tsconfig_webpack.json": "jsonc"
|
||||
}
|
||||
}
|
45
src/bin/hamcore/wwwroot/admin/default/.vscode/tasks.json
vendored
Normal file
45
src/bin/hamcore/wwwroot/admin/default/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "webpack build",
|
||||
"type": "npm",
|
||||
"script": "build",
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "webpack watch",
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"pattern": {
|
||||
"regexp": "^$"
|
||||
},
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": ".*Version: webpack.*",
|
||||
"endsPattern": ".*\\[built\\]"
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "tsc build",
|
||||
"type": "typescript",
|
||||
"tsconfig": "tsconfig.json",
|
||||
},
|
||||
{
|
||||
"label": "tsc watch",
|
||||
"type": "typescript",
|
||||
"tsconfig": "tsconfig.json",
|
||||
"option": "watch",
|
||||
"problemMatcher": [
|
||||
"$tsc-watch"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
23
src/bin/hamcore/wwwroot/admin/default/hub.html
Normal file
23
src/bin/hamcore/wwwroot/admin/default/hub.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--#include file="include_head.html" -->
|
||||
<body>
|
||||
<!--#include file="include_menu.html" -->
|
||||
<div class="container theme-showcase" role="main">
|
||||
<H2><div id="HUB_NAME"></div></H2>
|
||||
|
||||
<button class="btn btn-lg btn-danger" onclick="JS.DeleteVirtualHub(location.search);">Delete this Virtual Hub</button>
|
||||
|
||||
<H3>List of Users</H3>
|
||||
<ul id="USERS_LIST"></ul>
|
||||
|
||||
<H3>List of Active VPN Sessions</H3>
|
||||
<ul id="SESSIONS_LIST"></ul>
|
||||
<!--#include file="include_footer.html" -->
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
JS.HubAdminPage(location.search);
|
||||
</script>
|
||||
</html>
|
||||
|
@ -0,0 +1,4 @@
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<hr />
|
||||
<p>Copyright (c) SoftEther VPN Project under the Apache License 2.0.</p>
|
9
src/bin/hamcore/wwwroot/admin/default/include_head.html
Normal file
9
src/bin/hamcore/wwwroot/admin/default/include_head.html
Normal file
@ -0,0 +1,9 @@
|
||||
<head>
|
||||
<title>SoftEther VPN Server HTML5 Web Administration Console (Under construction!)</title>
|
||||
<script src="out_webpack/bundle.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" crossorigin="anonymous">
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" crossorigin="anonymous"></script>
|
||||
<link href="theme.css" rel="stylesheet">
|
||||
</head>
|
29
src/bin/hamcore/wwwroot/admin/default/include_menu.html
Normal file
29
src/bin/hamcore/wwwroot/admin/default/include_menu.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!-- Fixed navbar -->
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
|
||||
aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="./">SoftEther VPN Server Web Admin Console</a>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/api/">JSON-RPC API Reference</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||
aria-expanded="false">About <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="https://github.com/SoftEtherVPN/SoftEtherVPN">SoftEther VPN on GitHub</a></li>
|
||||
<li><a href="https://www.softether.org/">SoftEther.org Web Site</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
</div>
|
||||
</nav>
|
45
src/bin/hamcore/wwwroot/admin/default/index.html
Normal file
45
src/bin/hamcore/wwwroot/admin/default/index.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--#include file="include_head.html" -->
|
||||
<body>
|
||||
<!--#include file="include_menu.html" -->
|
||||
<div class="container theme-showcase" role="main">
|
||||
<H2>SoftEther VPN Server HTML5 Ajax-based Web Administration Console<BR>(Under construction!)</H2>
|
||||
<p>This is the sample of HTML5 Ajax-based VPN Server Web Administration Console.</p>
|
||||
<p>The purpose of this HTML5 admin page is to make administrators easy to set up and manage the running VPN Servers.</p>
|
||||
<h3>Authentication for this page</h3>
|
||||
<p>You must supply the HTTP basic authentication credential as following.</p>
|
||||
<ul>
|
||||
<li>To login to the VPN server as the entire server administrator, specify empty or "administrator" as the username field,
|
||||
and specify the server administrative password as the password field.</li>
|
||||
<li>To login to a particular Virtual Hub as the hub administrator, specify the hub name as the username field, and specify
|
||||
the hub administrative password as the password field.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Your HTML5 development contribution is very appreciated</h3>
|
||||
<p>This HTML5 page is obviously under construction, and providing very minimum functions as sample.<BR>This initial page is written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability.<BR>Please kindly consider to contribute for <strong><a href="https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/src/bin/hamcore/wwwroot/admin/">SoftEther VPN's development on GitHub.</a></strong> Your code will help every people running SoftEther VPN Server.</p>
|
||||
|
||||
<p>This HTML5 page's JavaScript codes directly call <strong><a href="/api/">SoftEther VPN Server JSON-RPC API</a></strong> on the running VPN Server from the web browser.<BR>You can also call the <strong><a href="/api/">SoftEther VPN Server JSON-RPC API</a></strong> remotely from your original application. (JavaScript, TypeScript, C#, Java, Python, Ruby, etc.)</p>
|
||||
<p><a href="/api/"><strong>The insanely kindness API reference</strong></a> is available.</p>
|
||||
|
||||
<H3>List of Virtual Hubs</H3>
|
||||
<ul id="HUB_LIST"></ul>
|
||||
|
||||
<H3>Create new Virtual Hub</H3>
|
||||
Virtual Hub Name:<BR>
|
||||
<input id="NEW_HUB_NAME" /> <button class="btn btn-lg btn-primary" onclick="JS.CreateNewHub($('#NEW_HUB_NAME').val(), '#HUB_LIST')">Create</button>
|
||||
|
||||
<H3>VPN Server Information</H3>
|
||||
<ul id="VPN_SERVER_INFO"></ul>
|
||||
|
||||
<H3>VPN Server Status</H3>
|
||||
<ul id="VPN_SERVER_STATUS"></ul>
|
||||
<!--#include file="include_footer.html" -->
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
JS.ShowVpnServerInfo("#VPN_SERVER_INFO", "#VPN_SERVER_STATUS");
|
||||
JS.ListVirtualHubs("#HUB_LIST");
|
||||
</script>
|
||||
</html>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user