diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..20098dd --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,30 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "paket": { + "version": "8.0.0", + "commands": [ + "paket" + ] + }, + "fake-cli": { + "version": "6.0.0", + "commands": [ + "fake" + ] + }, + "fantomas": { + "version": "6.2.3", + "commands": [ + "fantomas" + ] + }, + "fsdocs-tool": { + "version": "19.1.1", + "commands": [ + "fsdocs" + ] + } + } +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8341f53 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{yml,yaml,fs,fsx}] +indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a55ec9f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: build + +on: + push: + pull_request: + branches: [main] + paths: + - "**.fs" + - "**.fsproj" + +env: + DOTNET_VERSION: ${{ vars.DOTNET_VERSION }} # The .NET SDK version to use + +jobs: + build: + name: build-${{matrix.os}} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: paket-cache + key: ${{ runner.os }}-paket-${{ hashFiles('paket.lock') }} + restore-keys: | + ${{ runner.os }}-paket- + + - name: Install buildtools + run: dotnet tool restore + + - name: Install dependencies + run: dotnet paket restore && dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore diff --git a/.github/workflows/publish-github.yml b/.github/workflows/publish-github.yml new file mode 100644 index 0000000..40e2217 --- /dev/null +++ b/.github/workflows/publish-github.yml @@ -0,0 +1,40 @@ +name: Publish Github Packages + +on: + push: + tags: + - 'github-v*' + +permissions: + packages: write + +env: + DOTNET_VERSION: ${{ vars.DOTNET_VERSION }} + +jobs: + publish_upload: + name: Publish Github Packages + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + source-url: https://nuget.pkg.github.com/Shadowsocks-NET/index.json + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install buildtools + run: dotnet tool restore + + - name: Install dependencies + run: dotnet paket restore + + - name: Pack and upload NuGet package + run: | + dotnet pack -c Release + dotnet nuget push Aurum/bin/Release/*.nupkg --skip-duplicate --no-symbols --api-key ${{ secrets.HUB_PACKAGE_PAT }} --source https://nuget.pkg.github.com/Shadowsocks-NET/index.json + dotnet nuget push Aurum.*/bin/Release/*.nupkg --skip-duplicate --no-symbols --api-key ${{ secrets.HUB_PACKAGE_PAT }} --source https://nuget.pkg.github.com/Shadowsocks-NET/index.json diff --git a/.github/workflows/publish-myget.yml b/.github/workflows/publish-myget.yml new file mode 100644 index 0000000..896eaee --- /dev/null +++ b/.github/workflows/publish-myget.yml @@ -0,0 +1,34 @@ +name: Publish MyGet Packages + +on: + push: + tags: + - 'myget-v*' + +env: + DOTNET_VERSION: ${{ vars.DOTNET_VERSION }} + +jobs: + publish_upload: + name: Publish MyGet Packages + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Install buildtools + run: dotnet tool restore + + - name: Install dependencies + run: dotnet paket restore + + - name: Pack and upload NuGet package + run: | + dotnet pack -c Release + dotnet nuget push Aurum/bin/Release/*.nupkg --skip-duplicate --no-symbols -s https://www.myget.org/F/aurum/api/v3/index.json -k ${{ secrets.MYGET_API_KEY }} + dotnet nuget push Aurum.*/bin/Release/*.nupkg --skip-duplicate --no-symbols -s https://www.myget.org/F/aurum/api/v3/index.json -k ${{ secrets.MYGET_API_KEY }} diff --git a/.gitignore b/.gitignore index fb06f53..9f2cd70 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,22 @@ obj/ riderModule.iml /_ReSharper.Caches/ .vs +.vscode .idea + +.fake +.ionide + +#Paket dependency manager +.paket/ +paket-files/ +paket-cache/ + +#nuget files +nuget/**/* +!.gitkeep + +#fsdocs +tmp +.fsdocs +output diff --git a/Aurum.Configuration/AdapterTypes/VMessLegacyShare.fs b/Aurum.Configuration/AdapterTypes/VMessLegacyShare.fs new file mode 100644 index 0000000..dc1e79e --- /dev/null +++ b/Aurum.Configuration/AdapterTypes/VMessLegacyShare.fs @@ -0,0 +1,41 @@ +module Aurum.Configuration.AdapterTypes.VMessLegacyShare + +open System.Text.Json.Serialization + +// this implementation disregards alterId, an obsolete feature +// the only *disguise* method supported is HTTP host + +type VMessSecurity = + | [] None + | [] Zero + | [] Auto + | [] AES + | [] ChaCha20 + +type VMessTransport = + | [] TCP + | [] WebSocket + | [] QUIC + | [] GRPC + | [] MKCP // sing-box does not support this. + +type TLSSetting = + | [] None + | [] TLS + +type DisguiseType = + | [] None + | [] HTTP + +type ShareObject = + { v: int + add: string + port: int + id: string + scy: VMessSecurity + net: VMessTransport + tls: TLSSetting + sni: string + [] + dType: DisguiseType + host: string } diff --git a/Aurum.Configuration/Aurum.Configuration.fsproj b/Aurum.Configuration/Aurum.Configuration.fsproj new file mode 100644 index 0000000..7f06336 --- /dev/null +++ b/Aurum.Configuration/Aurum.Configuration.fsproj @@ -0,0 +1,41 @@ + + + net7.0 + true + Aurum.Configuration + 0.1.0-beta.1 + Shanoa Ice + Configuration Component for the Aurum project. + git + https://github.com/Shadowsocks-NET/Aurum + LGPL-3.0-only + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Aurum.Configuration/Base.fs b/Aurum.Configuration/Base.fs new file mode 100644 index 0000000..1ef8f56 --- /dev/null +++ b/Aurum.Configuration/Base.fs @@ -0,0 +1,8 @@ +module Aurum.Configuration.Base + +open Aurum.Configuration.Sing.Base +open Aurum.Configuration.V2fly.Base + +type Backend = + | SingBox of SingBaseConfiguration + | V2fly of V2flyBaseConfiguration diff --git a/Aurum.Configuration/ShareLinks.fs b/Aurum.Configuration/ShareLinks.fs new file mode 100644 index 0000000..67afc42 --- /dev/null +++ b/Aurum.Configuration/ShareLinks.fs @@ -0,0 +1,153 @@ +module Aurum.Configuration.ShareLinks + +open System.Collections.Generic +open Microsoft.AspNetCore.WebUtilities +open Aurum +open Aurum.Configuration.Shared.Adapter +open Aurum.Configuration.Shared.Shadowsocks +open Aurum.Configuration.Shared.V2fly +open FSharpPlus +open FSharpPlus.Data + +let createV2FlyObjectFromUri (uriObject: System.Uri) = + let protocolSetting = + match uriObject.Scheme with + | "vmess" -> + createVMessObject uriObject.Host uriObject.Port uriObject.UserInfo VMessSecurity.Auto + |> Success + | unknown -> Failure([ ShareLinkFormatException $"unknown sharelink protocol {unknown}" ]) + + let description = + if uriObject.Fragment.Length = 0 then + "" + else + uriObject.Fragment.Substring(1) + + let queryParams = QueryHelpers.ParseQuery uriObject.Query + + let retrieveFromShareLink = getFirstQuerystringEntry queryParams + + let tryRetrieveFromShareLink = tryRetrieveFromShareLink queryParams + + let securityType = tryRetrieveFromShareLink "security" |> Option.defaultValue "none" + + let securitySetting = + match securityType with + | "tls" -> + createTLSObject + (tryRetrieveFromShareLink "sni") + (tryRetrieveFromShareLink "alpn" + |> Option.map (fun alpn -> alpn.Split(",") |> Seq.toList)) + + |> Success + | "none" -> Success(TransportSecurity.None) + | unsupported -> Failure([ ShareLinkFormatException $"unsupported security type {unsupported}" ]) + + let transportType: Validation = + retrieveFromShareLink "type" + |> Result.mapError (fun e -> [ e ]) + |> Validation.ofResult + + let transportSetting = + Validation.bind + (fun transportType -> + match transportType with + | "ws" -> + createWebSocketObject (tryRetrieveFromShareLink "path") None None None (tryRetrieveFromShareLink "host") None + |> Success + | "grpc" -> + retrieveFromShareLink "serviceName" + |> Result.mapError (fun e -> [ e ]) + |> Validation.ofResult + |> Validation.map createGrpcObject + | "http" -> + createHttpObjectWithHost + (tryRetrieveFromShareLink "path") + (tryRetrieveFromShareLink "host") + (HTTP2) + (Some(Dictionary())) + |> Success + | "quic" -> createQuicObject () |> Success + | "kcp" -> + createKCPObject None None None None None None None (tryRetrieveFromShareLink "seed") + |> Success + | "tcp" -> createHttpObjectWithHost None None HTTP1 None |> Success + | unknown -> Failure([ ConfigurationParameterException $"unknown transport protocol {unknown}" ])) + transportType + + let v2flyObject = + createV2flyObject protocolSetting <*> transportSetting <*> securitySetting + |> Validation.map V2fly + + Validation.map (createConfigurationEntry description) v2flyObject + +type SsEncryptionInfo = { Method: string; PSKs: string list } + +let createShadowsocksObjectFromUri (uriObject: System.Uri) = + let host = uriObject.Host + let port = uriObject.Port + + let queryParams = QueryHelpers.ParseQuery uriObject.Query + + let tryRetrieveFromShareLink = tryRetrieveFromShareLink queryParams + + let description = + if uriObject.Fragment.Length = 0 then + "" + else + uriObject.Fragment.Substring(1) + + let encryptionInfo = + match + (if uriObject.UserInfo.IndexOf(":") <> -1 then + Array.toList (System.Uri.UnescapeDataString(uriObject.UserInfo).Split(":")) + else + Array.toList ((decodeBase64Url uriObject.UserInfo).Split(":"))) + with + | protocol :: info -> { Method = protocol; PSKs = info } |> Success + | _ -> Failure([ ShareLinkFormatException $"ill-formed user info \"{uriObject.UserInfo}\"" ]) + + let method = + Validation.bind + (fun encryptionInfo -> + match encryptionInfo.Method with + | "none" -> ShadowsocksEncryption.None |> Success + | "plain" -> ShadowsocksEncryption.Plain |> Success + | "chacha20-poly1305" -> ShadowsocksEncryption.ChaCha20 encryptionInfo.PSKs.Head |> Success + | "chacha20-ietf-poly1305" -> ShadowsocksEncryption.ChaCha20Ietf encryptionInfo.PSKs.Head |> Success + | "aes-128-gcm" -> ShadowsocksEncryption.AES128 encryptionInfo.PSKs.Head |> Success + | "aes-256-gcm" -> ShadowsocksEncryption.AES256 encryptionInfo.PSKs.Head |> Success + | "2022-blake3-aes-128-gcm" -> ShadowsocksEncryption.AES128_2022 encryptionInfo.PSKs |> Success + | "2022-blake3-aes-256-gcm" -> ShadowsocksEncryption.AES256_2022 encryptionInfo.PSKs |> Success + | "2022-blake3-chacha20-poly1305" -> ShadowsocksEncryption.ChaCha20_2022 encryptionInfo.PSKs |> Success + | "2022-blake3-chacha8-poly1305" -> ShadowsocksEncryption.ChaCha8_2022 encryptionInfo.PSKs |> Success + | method -> Failure([ ShareLinkFormatException $"unknown Shadowsocks encryption method {method}" ])) + encryptionInfo + + let plugin = + tryRetrieveFromShareLink "plugin" + |> Option.map (fun op -> + let pluginOpt = op.Split ";" |> Array.toList + + match pluginOpt with + | "obfs" :: opts -> SimpleObfs(System.String.Join(",", List.toArray opts)) |> Success + | "v2ray" :: opts -> V2ray(System.String.Join(",", List.toArray opts)) |> Success + | pluginName :: _ -> Failure([ ShareLinkFormatException $"unknown plugin {pluginName}" ]) + | unknown -> Failure([ ShareLinkFormatException $"ill-formed plugin option \"{unknown}\"" ])) + |> sequence + + let shadowsocksObject = + createShadowsocksObject host port method <*> plugin + |> Validation.map Shadowsocks + + Validation.map (createConfigurationEntry description) shadowsocksObject + + +let decodeShareLink link = + let uriObject = System.Uri link + + match uriObject.Scheme with + | "vmess" + | "vless" -> createV2FlyObjectFromUri uriObject + | "ss" -> createShadowsocksObjectFromUri uriObject + | unknown -> Failure([ ShareLinkFormatException $"unsupported sharelink protocol {unknown}" ]) diff --git a/Aurum.Configuration/Shared/Adapter.fs b/Aurum.Configuration/Shared/Adapter.fs new file mode 100644 index 0000000..300731a --- /dev/null +++ b/Aurum.Configuration/Shared/Adapter.fs @@ -0,0 +1,20 @@ +module Aurum.Configuration.Shared.Adapter + +open Aurum.Configuration.Shared.V2fly +open Aurum.Configuration.Shared.Shadowsocks + +type SharedConfigObject = { TcpFastOpen: bool } + +type ConfigurationFamily = + | V2fly of V2flyObject + | Shadowsocks of ShadowsocksObject + +type ConfigurationEntry = + { Name: string + Config: ConfigurationFamily } + +module ConfigurationEntry = + let inline _Name f p = + f p.Name <&> fun x -> { p with Name = x } + +let createConfigurationEntry name config = { Name = name; Config = config } diff --git a/Aurum.Configuration/Shared/Routing.fs b/Aurum.Configuration/Shared/Routing.fs new file mode 100644 index 0000000..a199370 --- /dev/null +++ b/Aurum.Configuration/Shared/Routing.fs @@ -0,0 +1,385 @@ +module Aurum.Configuration.Shared.Routing + +open System.Text.Json.Serialization +open Aurum +open FSharpPlus.Lens +open FSharpPlus.Data +open FSharpPlus + +let inline traverseResultList (f: 'a -> Result<'b, 'e>) (xs: 'a list) : Result<'b list, 'e> = traverse f xs + +type DomainStrategy = + | AsIs + | IPIfNonMatch + | IPOnDemand + +type RuleMatchProtocol = + | HTTP + | TLS + +type RuleMatchNetwork = + | [] TCP + | [] UDP + | [] TCPAndUDP + +type DomainMatchingType = + | Full of string + | Regex of string + | Suffix of string + | Keyword of string + +module DomainMatchingType = + let inline _Full f p = + prism' + Full + (fun x -> + match x with + | Full x -> Some x + | _ -> None) + f + p + + let inline _Regex f p = + prism' + Regex + (fun x -> + match x with + | Regex x -> Some x + | _ -> None) + f + p + + let inline _Suffix f p = + prism' + Suffix + (fun x -> + match x with + | Suffix x -> Some x + | _ -> None) + f + p + + let inline _Keyword f p = + prism' + Keyword + (fun x -> + match x with + | Keyword x -> Some x + | _ -> None) + f + p + +type DomainType = + | Domain of DomainMatchingType + | Geosite of string + +module DomainType = + let inline _Domain f p = + prism' + Domain + (fun x -> + match x with + | Domain x -> Some x + | _ -> None) + f + p + + let inline _Geosite f p = + prism' + Geosite + (fun x -> + match x with + | Geosite x -> Some x + | _ -> None) + f + p + +type IpType = + | Ip of string + | Geoip of string + +module IpType = + let inline _Ip f p = + prism' + Ip + (fun x -> + match x with + | Ip x -> Some x + | _ -> None) + f + p + + let inline _Geoip f p = + prism' + Geoip + (fun x -> + match x with + | Geoip x -> Some x + | _ -> None) + f + p + +type RuleObject = + { Domain: DomainType list option + Ip: IpType list option + Port: string option + Networks: RuleMatchNetwork option + Protocol: RuleMatchProtocol option + InboundTag: string list option + Tag: string } + +module RuleObject = + let inline _Domain f p = + f p.Domain <&> fun x -> { p with Domain = x } + + let inline _Ip f p = f p.Ip <&> fun x -> { p with Ip = x } + + let inline _Port f p = + f p.Port <&> fun x -> { p with Port = x } + + let inline _Networks f p = + f p.Networks <&> fun x -> { p with Networks = x } + + let inline _Protocol f p = + f p.Protocol <&> fun x -> { p with Protocol = x } + + let inline _InboundTag f p = + f p.InboundTag <&> fun x -> { p with InboundTag = x } + + let inline _Tag f p = f p.Tag <&> fun x -> { p with Tag = x } + +type DomainRuleList = DomainType list +type IpRuleList = IpType list + +type DomainStringListObject = + { Direct: DomainRuleList + Proxy: DomainRuleList + Block: DomainRuleList } + +module DomainStringListObject = + let inline _Direct f p = + f p.Direct <&> fun x -> { p with Direct = x } + + let inline _Proxy f p = + f p.Proxy <&> fun x -> { p with Proxy = x } + + let inline _Block f p = + f p.Block <&> fun x -> { p with Block = x } + +type IpStringListObject = + { Direct: IpRuleList + Proxy: IpRuleList + Block: IpRuleList } + +module IpStringListObject = + let inline _Direct f p = + f p.Direct <&> fun x -> { p with Direct = x } + + let inline _Proxy f p = + f p.Proxy <&> fun x -> { p with Proxy = x } + + let inline _Block f p = + f p.Block <&> fun x -> { p with Block = x } + +type RulePresets = + | BypassMainland // adopted from v2rayA's mainland whitelist mode + | GFWList of string list // uses Loyalsoldier/v2ray-rules-dat's gfw.txt + | Loyalsoldier // uses Loyalsoldier/v2ray-rules-dat's recommended v2ray setting in README + | Empty // no preset rules + +// when using full domain list or the recommended setting, these options will be ignored +type RuleConstructionStrategy = { BlockAds: bool } + +module RuleConstructionStrategy = + let inline _BlockAds f p = + f p.BlockAds <&> fun x -> { p with BlockAds = x } + +type ProxyTag = + | Outbound of string + | Balancer of string + +module ProxyTag = + let inline _Outbound f p = + prism' + Outbound + (fun x -> + match x with + | Outbound x -> Some x + | _ -> None) + f + p + + let inline _Balancer f p = + prism' + Balancer + (fun x -> + match x with + | Balancer x -> Some x + | _ -> None) + f + p + +type RuleType = + | Direct of DomainRuleList option * IpRuleList option + | Proxy of DomainRuleList option * IpRuleList option + | Block of DomainRuleList option * IpRuleList option + | Skip + +let constructDirect (domainRule, ipRule) = + { Domain = domainRule + Ip = ipRule + Port = None + Networks = Some TCPAndUDP + Protocol = None + InboundTag = None + Tag = "freedom" } + +let constructProxy (domainRule, ipRule) proxyTag = + { Domain = domainRule + Ip = ipRule + Port = None + Networks = Some TCPAndUDP + Protocol = None + InboundTag = None + Tag = proxyTag } + +let constructBlock (domainRule, ipRule) = + { Domain = domainRule + Ip = ipRule + Port = None + Networks = Some TCPAndUDP + Protocol = None + InboundTag = None + Tag = "blackhole" } + +let constructSingleRule rule proxyTag = + match rule with + | Direct(domainRule, ipRule) -> Some(constructDirect (domainRule, ipRule)) + | Proxy(domainRule, ipRule) -> Some(constructProxy (domainRule, ipRule) proxyTag) + | Block(domainRule, ipRule) -> Some(constructBlock (domainRule, ipRule)) + | Skip -> None + +let constructRuleSet ruleSet proxyTag = + match ruleSet with + | Ok ruleSet -> + List.map (fun rule -> constructSingleRule rule proxyTag) ruleSet + |> List.filter Option.isSome + |> List.map Option.get + |> Ok + | Error e -> Error e + +let mergeRules rule1 rule2 = + match rule1, rule2 with + | Direct(xDomain, xIP), Direct(yDomain, yIP) -> Ok(Direct(mergeOptionList xDomain yDomain, mergeOptionList xIP yIP)) + | Proxy(xDomain, xIP), Proxy(yDomain, yIP) -> Ok(Proxy(mergeOptionList xDomain yDomain, mergeOptionList xIP yIP)) + | Block(xDomain, xIP), Block(yDomain, yIP) -> Ok(Block(mergeOptionList xDomain yDomain, mergeOptionList xIP yIP)) + | _ -> Error RuleTypeNotMatchException + +let constructPreset constructionStrategy = + if constructionStrategy.BlockAds then + Block(Some [ Geosite "category-ads-all" ], None) + else + Skip + +let generateRoutingRules (domainList, constructionStrategy, userDomainRules: DomainStringListObject, userIpRules) = + match domainList with + | BypassMainland -> + let blockPreset = constructPreset constructionStrategy + + let userProxyRule = Proxy(Some userDomainRules.Proxy, Some userIpRules.Proxy) + + let userDirectRule = Direct(Some userDomainRules.Direct, Some userIpRules.Direct) + + let userBlockRule = Block(Some userDomainRules.Block, Some userIpRules.Block) + + let geolocationProxy = Proxy(Some [ Geosite "geolocation-!cn" ], None) + + let scholarProxy = Proxy(Some [ Geosite "google-scholar" ], None) + + let scholarDirect = + Direct(Some [ Geosite "category-scholar-!cn"; Geosite "category-scholar-cn" ], None) + + let siteCNDirect = Direct(Some [ Geosite "cn" ], None) + + let sarProxy = Proxy(None, Some [ Geoip "hk"; Geoip "mo" ]) + + let ipDirect = Direct(None, Some [ Geoip "private"; Geoip "cn" ]) + + constructRuleSet ( + (mergeRules userBlockRule blockPreset + :: ([ userDirectRule + userProxyRule + geolocationProxy + scholarProxy + scholarDirect + siteCNDirect + sarProxy + ipDirect + Proxy(None, None) ] + |> List.map Ok)) + |> traverseResultList id + ) + | GFWList domainList -> + let blockPreset = constructPreset constructionStrategy + + let userBlockRule = Block(Some userDomainRules.Block, Some userIpRules.Block) + + let userDirectRule = Block(Some userDomainRules.Direct, Some userIpRules.Direct) + + let userProxyRule = Proxy(Some userDomainRules.Proxy, Some userIpRules.Proxy) + + let proxyRule = + Proxy(Some(domainList |> List.map (fun a -> Domain(Suffix a))), None) + + constructRuleSet ( + [ mergeRules userBlockRule blockPreset + Ok userDirectRule + mergeRules userProxyRule proxyRule + Ok(Proxy(None, None)) ] + |> traverseResultList id + ) + | Loyalsoldier -> + let userBlockRule = Block(Some userDomainRules.Block, Some userIpRules.Block) + + let userDirectRule = Block(Some userDomainRules.Direct, Some userIpRules.Direct) + + let userProxyRule = Proxy(Some userDomainRules.Proxy, Some userIpRules.Proxy) + + let blockRule = Block(Some([ Geosite "category-ads-all" ]), None) + + let directRule1 = + Direct( + Some( + [ Geosite "private" + Geosite "apple-cn" + Geosite "google-cn" + Geosite "tld-cn" + Geosite "category-games@cn" ] + ), + None + ) + + let proxyRule = Proxy(Some([ Geosite "geolocation-!cn" ]), None) + + let directRule2 = Direct(Some([ Geosite "cn" ]), None) + + constructRuleSet ( + (mergeRules userBlockRule blockRule) + :: ([ userDirectRule + userProxyRule + directRule1 + proxyRule + directRule2 + Proxy(None, None) ] + |> List.map Ok) + |> traverseResultList id + ) + | Empty -> + let blockPreset = constructPreset constructionStrategy + + constructRuleSet ( + [ mergeRules blockPreset (Block(Some userDomainRules.Block, Some userIpRules.Block)) + Ok(Direct(Some userDomainRules.Direct, Some userIpRules.Direct)) + Ok(Proxy(Some userDomainRules.Proxy, Some userIpRules.Proxy)) ] + |> traverseResultList id + ) diff --git a/Aurum.Configuration/Shared/Shadowsocks.fs b/Aurum.Configuration/Shared/Shadowsocks.fs new file mode 100644 index 0000000..39d9d8c --- /dev/null +++ b/Aurum.Configuration/Shared/Shadowsocks.fs @@ -0,0 +1,171 @@ +module Aurum.Configuration.Shared.Shadowsocks + +open System.Text.Json.Serialization +open FSharpPlus.Lens +open FSharpPlus.Data + +// ShadowsocksR and legacy stream cipher are not supported, since they have serious security issues. If users really wish to use them, they could supply custom JSON config provided their backend has proper support. +// Password / PSKs are embedded in this DU's fields +[] +type ShadowsocksEncryption = + | [] None + | [] Plain + | [] ChaCha20 of Password: string + | [] ChaCha20Ietf of Password: string + | [] AES128 of Password: string + | [] AES256 of Password: string + | [] AES128_2022 of PSKs: string list + | [] AES256_2022 of PSKs: string list + | [] ChaCha20_2022 of PSKs: string list + | [] ChaCha8_2022 of PSKs: string list + +module ShadowsocksEncryption = + let inline _None f p = + prism' + (fun _ -> ShadowsocksEncryption.None) + (fun x -> + match x with + | ShadowsocksEncryption.None -> Some ShadowsocksEncryption.None + | _ -> None) + f + p + + let inline _Plain f p = + prism' + (fun _ -> ShadowsocksEncryption.Plain) + (fun x -> + match x with + | ShadowsocksEncryption.Plain -> Some ShadowsocksEncryption.Plain + | _ -> None) + f + p + + let inline _ChaCha20 f p = + prism' + ShadowsocksEncryption.ChaCha20 + (fun x -> + match x with + | ShadowsocksEncryption.ChaCha20 x -> Some(ShadowsocksEncryption.ChaCha20 x) + | _ -> None) + f + p + + let inline _ChaCha20Ietf f p = + prism' + ShadowsocksEncryption.ChaCha20Ietf + (fun x -> + match x with + | ShadowsocksEncryption.ChaCha20Ietf x -> Some(ShadowsocksEncryption.ChaCha20Ietf x) + | _ -> None) + f + p + + let inline _AES128 f p = + prism' + ShadowsocksEncryption.AES128 + (fun x -> + match x with + | ShadowsocksEncryption.AES128 x -> Some(ShadowsocksEncryption.AES128 x) + | _ -> None) + f + p + + let inline _AES256 f p = + prism' + ShadowsocksEncryption.AES256 + (fun x -> + match x with + | ShadowsocksEncryption.AES256 x -> Some(ShadowsocksEncryption.AES256 x) + | _ -> None) + f + p + + let inline _AES128_2022 f p = + prism' + ShadowsocksEncryption.AES128_2022 + (fun x -> + match x with + | ShadowsocksEncryption.AES128_2022 x -> Some(ShadowsocksEncryption.AES128_2022 x) + | _ -> None) + f + p + + let inline _AES256_2022 f p = + prism' + ShadowsocksEncryption.AES256_2022 + (fun x -> + match x with + | ShadowsocksEncryption.AES256_2022 x -> Some(ShadowsocksEncryption.AES256_2022 x) + | _ -> None) + f + p + + let inline _ChaCha20_2022 f p = + prism' + ShadowsocksEncryption.ChaCha20_2022 + (fun x -> + match x with + | ShadowsocksEncryption.ChaCha20_2022 x -> Some(ShadowsocksEncryption.ChaCha20_2022 x) + | _ -> None) + f + p + + let inline _ChaCha8_2022 f p = + prism' + ShadowsocksEncryption.ChaCha8_2022 + (fun x -> + match x with + | ShadowsocksEncryption.ChaCha8_2022 x -> Some(ShadowsocksEncryption.ChaCha8_2022 x) + | _ -> None) + f + p + +type ShadowsocksPlugin = + | SimpleObfs of option: string + | V2ray of option: string + +module ShadowsocksPlugin = + let inline _SimpleObfs f p = + prism' + ShadowsocksPlugin.SimpleObfs + (fun x -> + match x with + | ShadowsocksPlugin.SimpleObfs x -> Some(ShadowsocksPlugin.SimpleObfs x) + | _ -> None) + f + p + + let inline _V2ray f p = + prism' + ShadowsocksPlugin.V2ray + (fun x -> + match x with + | ShadowsocksPlugin.V2ray x -> Some(ShadowsocksPlugin.V2ray x) + | _ -> None) + f + p + +type ShadowsocksObject = + { Host: string + Port: int + Encryption: ShadowsocksEncryption + Plugin: ShadowsocksPlugin option } + +module ShadowsocksObject = + let inline _Host f p = + f p.Host <&> fun x -> { p with Host = x } + + let inline _Port f p = + f p.Port <&> fun x -> { p with Port = x } + + let inline _Encryption f p = + f p.Encryption <&> fun x -> { p with Encryption = x } + + let inline _Plugin f p = + f p.Plugin <&> fun x -> { p with Plugin = x } + +let createShadowsocksObject host port encryption plugin = + { Host = host + Port = port + Encryption = encryption + Plugin = plugin } diff --git a/Aurum.Configuration/Shared/Subscription.fs b/Aurum.Configuration/Shared/Subscription.fs new file mode 100644 index 0000000..3b123d9 --- /dev/null +++ b/Aurum.Configuration/Shared/Subscription.fs @@ -0,0 +1,47 @@ +module Aurum.Configuration.Shared.Share + +open Aurum.Configuration.SubscriptionAdapter.OOCv1 +open FSharpPlus.Lens + +type Subscriptions = + | Base64 of url: string + | Clash of url: string // WIP + | OocV1 of apiToken: OocApiToken // WIP + | SingOutbound of url: OocApiToken + +module Subscriptions = + let inline _Base64 f = + prism' + Base64 + (fun x -> + match x with + | Base64 x -> Some x + | _ -> None) + f + + let inline _Clash f = + prism' + Clash + (fun x -> + match x with + | Clash x -> Some x + | _ -> None) + f + + let inline _OocV1 f = + prism' + OocV1 + (fun x -> + match x with + | OocV1 x -> Some x + | _ -> None) + f + + let inline _SingOutbound f = + prism' + SingOutbound + (fun x -> + match x with + | SingOutbound x -> Some x + | _ -> None) + f diff --git a/Aurum.Configuration/Shared/V2fly.fs b/Aurum.Configuration/Shared/V2fly.fs new file mode 100644 index 0000000..30762c5 --- /dev/null +++ b/Aurum.Configuration/Shared/V2fly.fs @@ -0,0 +1,374 @@ +module Aurum.Configuration.Shared.V2fly + +open System.Text.Json.Serialization +open Aurum +open System.Collections.Generic +open FSharpPlus.Lens + +type HttpVersion = + | [] HTTP1 + | [] HTTP2 + | [] HTTP3 + +type TransportProtocol = + | KCP of KcpObject + | WebSocket of WebSocketObject + | HTTP of HttpObject + | QUIC + | GRPC of GrpcObject + +and WebSocketObject = + { Path: string + MaxEarlyData: int + BrowserForwarding: bool + EarlyDataHeader: string + Headers: Dictionary option } + +and KcpObject = + { MTU: int + TTI: int + UplinkCapacity: int + DownlinkCapacity: int + Congestion: bool + ReadBufferSize: int + WriteBufferSize: int + Seed: string option } + +and HttpObject = + { Host: string list + Path: string + Version: HttpVersion + Headers: Dictionary option } + +and GrpcObject = { ServiceName: string } + +module WebSocketObject = + let inline _Path f (p: WebSocketObject) = + f p.Path <&> fun x -> { p with Path = x } + + let inline _MaxEarlyData f (p: WebSocketObject) = + f p.MaxEarlyData <&> fun x -> { p with MaxEarlyData = x } + + let inline _BrowserForwarding f (p: WebSocketObject) = + f p.BrowserForwarding <&> fun x -> { p with BrowserForwarding = x } + + let inline _EarlyDataHeader f (p: WebSocketObject) = + f p.EarlyDataHeader <&> fun x -> { p with EarlyDataHeader = x } + + let inline _Headers f (p: WebSocketObject) = + f p.Headers <&> fun x -> { p with Headers = x } + +module KcpObject = + let inline _MTU f (p: KcpObject) = f p.MTU <&> fun x -> { p with MTU = x } + + let inline _TTI f (p: KcpObject) = f p.TTI <&> fun x -> { p with TTI = x } + + let inline _UplinkCapacity f (p: KcpObject) = + f p.UplinkCapacity <&> fun x -> { p with UplinkCapacity = x } + + let inline _DownlinkCapacity f (p: KcpObject) = + f p.DownlinkCapacity <&> fun x -> { p with DownlinkCapacity = x } + + let inline _Congestion f (p: KcpObject) = + f p.Congestion <&> fun x -> { p with Congestion = x } + + let inline _ReadBufferSize f (p: KcpObject) = + f p.ReadBufferSize <&> fun x -> { p with ReadBufferSize = x } + + let inline _WriteBufferSize f (p: KcpObject) = + f p.WriteBufferSize <&> fun x -> { p with WriteBufferSize = x } + + let inline _Seed f (p: KcpObject) = + f p.Seed <&> fun x -> { p with Seed = x } + +module HttpObject = + let inline _Host f (p: HttpObject) = + f p.Host <&> fun x -> { p with Host = x } + + let inline _Path f (p: HttpObject) = + f p.Path <&> fun x -> { p with Path = x } + + let inline _Headers f (p: HttpObject) = + f p.Headers <&> fun x -> { p with Headers = x } + +module GrpcObject = + let inline _ServiceName f (p: GrpcObject) = + f p.ServiceName <&> fun x -> { p with ServiceName = x } + +module TransportProtocol = + let inline _WebSocket f = + prism' + WebSocket + (fun x -> + match x with + | WebSocket x -> Some(WebSocket x) + | _ -> None) + f + + let inline _KCP f = + prism' + KCP + (fun x -> + match x with + | KCP x -> Some(KCP x) + | _ -> None) + f + + let inline _HTTP f = + prism' + HTTP + (fun x -> + match x with + | HTTP x -> Some(HTTP x) + | _ -> None) + f + + let inline _QUIC f = + prism' + (fun _ -> QUIC) + (fun x -> + match x with + | QUIC -> Some QUIC + | _ -> None) + f + + let inline _GRPC f = + prism' + GRPC + (fun x -> + match x with + | GRPC x -> Some(GRPC x) + | _ -> None) + f + +type TlsObject = + { ServerName: string option + AllowInsecure: bool option + ALPN: string list option } + +module TlsObject = + let inline _ServerName f (p: TlsObject) = + f p.ServerName <&> fun x -> { p with ServerName = x } + + let inline _AllowInsecure f (p: TlsObject) = + f p.AllowInsecure <&> fun x -> { p with AllowInsecure = x } + + let inline _ALPN f (p: TlsObject) = + f p.ALPN <&> fun x -> { p with ALPN = x } + +[] +type TransportSecurity = + | [] None + | [] TLS of TlsObject + // only for reservation. V2fly and Sing backend does not have XTLS support. + | [] XTLS + +module TransportSecurity = + let inline _None f = + prism' + (fun _ -> TransportSecurity.None) + (fun x -> + match x with + | TransportSecurity.None -> Some TransportSecurity.None + | _ -> None) + f + + let inline _TLS f = + prism' + TransportSecurity.TLS + (fun x -> + match x with + | TransportSecurity.TLS x -> Some(TransportSecurity.TLS x) + | _ -> None) + f + + let inline _XTLS f = + prism' + (fun _ -> TransportSecurity.XTLS) + (fun x -> + match x with + | TransportSecurity.XTLS -> Some TransportSecurity.XTLS + | _ -> None) + f + +type StreamSettings = + { TransportSettings: TransportProtocol + SecuritySettings: TransportSecurity } + +module StreamSettings = + let inline _TransportSettings f (p: StreamSettings) = + f p.TransportSettings <&> fun x -> { p with TransportSettings = x } + + let inline _SecuritySettings f (p: StreamSettings) = + f p.SecuritySettings <&> fun x -> { p with SecuritySettings = x } + +[] +// VLESS deprecated and subject to removal in v2fly/v2ray-core v5 +// It is not supported in sing-box +type VlessEncryption = | [] None + +module VlessEncryption = + let inline _None f = + prism' + (fun _ -> VlessEncryption.None) + (fun x -> + match x with + | VlessEncryption.None -> Some VlessEncryption.None + | _ -> None) + f + +// V2fly v5 config does not support it yet +// The core retains its support, though, and sing-box also supports it +[] +type VMessSecurity = + | [] None + | [] Zero + | [] Auto + | [] AES + | [] ChaCha20 + +type MuxObject = + { Enabled: bool + Concurrency: int option } + +module MuxObject = + let inline _Enabled f (p: MuxObject) = + f p.Enabled <&> fun x -> { p with Enabled = x } + + let inline _Concurrency f (p: MuxObject) = + f p.Concurrency <&> fun x -> { p with Concurrency = x } + +type VMessObject = + { Address: string + Port: int + UUID: string + Security: VMessSecurity } + + member this.GetServerInfo() = this.Address, this.Port + +module VMessObject = + let inline _Address f (p: VMessObject) = + f p.Address <&> fun x -> { p with Address = x } + + let inline _Port f (p: VMessObject) = + f p.Port <&> fun x -> { p with Port = x } + + let inline _UUID f (p: VMessObject) = + f p.UUID <&> fun x -> { p with UUID = x } + + let inline _Security f (p: VMessObject) = + f p.Security <&> fun x -> { p with Security = x } + +type Protocols = + | [] VLESS + | [] VMess of VMessObject + +module Protocols = + let inline _VLESS f = + prism' + (fun _ -> Protocols.VLESS) + (fun x -> + match x with + | Protocols.VLESS -> Some Protocols.VLESS + | _ -> None) + f + + let inline _VMess f = + prism' + Protocols.VMess + (fun x -> + match x with + | Protocols.VMess x -> Some(Protocols.VMess x) + | _ -> None) + f + +type V2flyObject = + { Protocol: Protocols + StreamSettings: StreamSettings } + +module V2flyObject = + let inline _Protocol f (p: V2flyObject) = + f p.Protocol <&> fun x -> { p with Protocol = x } + + let inline _StreamSettings f (p: V2flyObject) = + f p.StreamSettings <&> fun x -> { p with StreamSettings = x } + +let createWebSocketObject path maxEarlyData browserForwarding earlyDataHeader host headers = + let constructedHeaders = Option.defaultValue (Dictionary()) headers + + match host with + | Some host -> constructedHeaders.Add("Host", host) + | None -> () + + let config = + { WebSocketObject.Path = Option.defaultValue "/" path + MaxEarlyData = Option.defaultValue 0 maxEarlyData + BrowserForwarding = Option.defaultValue false browserForwarding + EarlyDataHeader = Option.defaultValue "" earlyDataHeader + Headers = Some(constructedHeaders) } + + WebSocket config + +let createGrpcObject serviceName = + let config = { ServiceName = serviceName } + + GRPC config + +let createHttpObjectWithHost path (host: string option) version headers = + let parsedHost = + Option.map (fun (host: string) -> host.Split "," |> Seq.toList) host + |> Option.defaultValue [] + + let config = + { HttpObject.Path = Option.defaultValue "/" path + Headers = headers + Version = version + Host = parsedHost } + + HTTP config + +let createKCPObject mtu tti uplinkCapacity downlinkCapacity congestion readBufferSize writeBufferSize seed = + + let config = + { KcpObject.MTU = Option.defaultValue 1350 mtu + TTI = Option.defaultValue 20 tti + UplinkCapacity = Option.defaultValue 5 uplinkCapacity + DownlinkCapacity = Option.defaultValue 20 downlinkCapacity + Congestion = Option.defaultValue false congestion + ReadBufferSize = Option.defaultValue 2 readBufferSize + WriteBufferSize = Option.defaultValue 2 writeBufferSize + Seed = seed } + + KCP config + +let createQuicObject () = QUIC + +let createTLSObject serverName alpn = + TransportSecurity.TLS + { TlsObject.ServerName = serverName + ALPN = alpn + AllowInsecure = Some false } + +let createVMessObject host port uuid security = + VMess + { VMessObject.Address = host + Port = port + UUID = uuid + Security = security } + +let parseVMessSecurity security = + let security = Option.defaultValue "auto" security + + match security with + | "none" -> Ok VMessSecurity.None + | "zero" -> Ok VMessSecurity.Zero + | "auto" -> Ok VMessSecurity.Auto + | "aes-128-gcm" -> Ok VMessSecurity.AES + | "chacha20-poly1305" -> Ok VMessSecurity.ChaCha20 + | _ -> Error(ConfigurationParameterException "unknown security type") + +let createV2flyObject protocol transportSettings securitySettings = + { Protocol = protocol + StreamSettings = + { TransportSettings = transportSettings + SecuritySettings = securitySettings } } diff --git a/Aurum.Configuration/Sing/Base.fs b/Aurum.Configuration/Sing/Base.fs new file mode 100644 index 0000000..47bc8c9 --- /dev/null +++ b/Aurum.Configuration/Sing/Base.fs @@ -0,0 +1,11 @@ +module Aurum.Configuration.Sing.Base + +open Aurum.Configuration.Sing.Outbound + +type SingBaseConfiguration = + { dns: obj + log: obj + inbounds: obj list + outbounds: Outbounds list + route: obj + experimental: obj } diff --git a/Aurum.Configuration/Sing/DNS.fs b/Aurum.Configuration/Sing/DNS.fs new file mode 100644 index 0000000..479dccd --- /dev/null +++ b/Aurum.Configuration/Sing/DNS.fs @@ -0,0 +1,116 @@ +module Aurum.Configuration.Sing.DNS + +open Aurum.Configuration.Shared.Routing +open Aurum.Configuration.Sing.Routing + +type DnsRuleObject = + { Inbound: string list option + QueryType: string list option + Network: NetworkType option + Protocol: RuleMatchProtocol list option + Domain: string list option + DomainSuffix: string list option + DomainKeyword: string list option + DomainRegex: string list option + Port: int list option + PortRange: string list option + ProcessName: string list option + ProcessPath: string list option + PackageName: string list option + ClashMode: string option + Outbound: string list option + Server: string + DisableCache: bool option + RewriteTtl: int option } + +type DnsDomainRuleType = + | Full of string list + | Suffix of string list + | Keyword of string list + | Regex of string list + +type DnsServerObject = { tag: string; address: string } + +type RuleType = + | Block of rules: DnsDomainRuleType + | Redirect of rules: DnsDomainRuleType * tag: string + +type DnsStrategy = + | PreferIpv4 + | PreferIpv6 + | Ipv4Only + | Ipv6Only + +type InternalDnsObject = + { rules: RuleType list + servers: DnsServerObject list + final: string + strategy: DnsStrategy } + +type DnsObject = + { rules: DnsRuleObject list + servers: DnsServerObject list + final: string + strategy: DnsStrategy } + +let mapDnsRuleType dnsRuleType (origObject: DnsRuleObject) = + match dnsRuleType with + | Full domain -> { origObject with Domain = Some domain } + | Suffix domain -> + { origObject with + DomainSuffix = Some domain } + | Keyword domain -> + { origObject with + DomainKeyword = Some domain } + | Regex domain -> + { origObject with + DomainRegex = Some domain } + +let mapRuleType ruleType = + match ruleType with + | Block rules -> + { Inbound = None + QueryType = None + Network = None + Protocol = None + Domain = None + DomainSuffix = None + DomainKeyword = None + DomainRegex = None + Port = None + PortRange = None + ProcessName = None + ProcessPath = None + PackageName = None + ClashMode = None + Outbound = None + Server = "block" + DisableCache = None + RewriteTtl = None } + |> mapDnsRuleType rules + | Redirect(rules, tag) -> + { Inbound = None + QueryType = None + Network = None + Protocol = None + Domain = None + DomainSuffix = None + DomainKeyword = None + DomainRegex = None + Port = None + PortRange = None + ProcessName = None + ProcessPath = None + PackageName = None + ClashMode = None + Outbound = None + Server = tag + DisableCache = None + RewriteTtl = None } + |> mapDnsRuleType rules + +let createDnsObject (internalDnsObject: InternalDnsObject) = + { DnsObject.rules = List.map mapRuleType internalDnsObject.rules + DnsObject.servers = internalDnsObject.servers + DnsObject.final = internalDnsObject.final + DnsObject.strategy = internalDnsObject.strategy } diff --git a/Aurum.Configuration/Sing/Inbound.fs b/Aurum.Configuration/Sing/Inbound.fs new file mode 100644 index 0000000..a7ea886 --- /dev/null +++ b/Aurum.Configuration/Sing/Inbound.fs @@ -0,0 +1,315 @@ +module Aurum.Configuration.Sing.Inbound + +open Aurum.Configuration.Sing.Shared +open FSharpPlus.Lens + +type SOCKSRecord = + { tag: string + + listen: string + listenPort: int16 option + tcpFastOpen: bool option + udpFragment: bool option + sniff: bool option + sniffOverrideDestination: bool option + domainStrategy: string option + udpTimeout: int option + proxyProtocol: bool option + proxyProtocolAcceptNoHeader: bool option + detour: string option + + users: obj list } + +module SOCKSRecord = + let inline _tag f p = f p.tag <&> fun x -> { p with tag = x } + + let inline _listen f p = + f p.listen <&> fun x -> { p with listen = x } + + let inline _listenPort f p = + f p.listenPort <&> fun x -> { p with listenPort = x } + + let inline _tcpFastOpen f p = + f p.tcpFastOpen <&> fun x -> { p with tcpFastOpen = x } + + let inline _udpFragment f p = + f p.udpFragment <&> fun x -> { p with udpFragment = x } + + let inline _sniff f p = + f p.sniff <&> fun x -> { p with sniff = x } + + let inline _sniffOverrideDestination f p = + f p.sniffOverrideDestination + <&> fun x -> { p with sniffOverrideDestination = x } + + let inline _domainStrategy f p = + f p.domainStrategy <&> fun x -> { p with domainStrategy = x } + + let inline _udpTimeout f p = + f p.udpTimeout <&> fun x -> { p with udpTimeout = x } + + let inline _proxyProtocol f p = + f p.proxyProtocol <&> fun x -> { p with proxyProtocol = x } + + let inline _proxyProtocolAcceptNoHeader f p = + f p.proxyProtocolAcceptNoHeader + <&> fun x -> + { p with + proxyProtocolAcceptNoHeader = x } + + let inline _detour f p = + f p.detour <&> fun x -> { p with detour = x } + + let inline _users f p = + f p.users <&> fun x -> { p with users = x } + +type HttpRecord = + { tag: string + + listen: string + listenPort: int16 option + tcpFastOpen: bool option + udpFragment: bool option + sniff: bool option + sniffOverrideDestination: bool option + domainStrategy: string option + udpTimeout: int option + proxyProtocol: bool option + proxyProtocolAcceptNoHeader: bool option + detour: string option + + users: obj list option + tls: TLSInbound option + setSystemProxy: bool option } + +module HttpRecord = + let inline _tag f p = f p.tag <&> fun x -> { p with tag = x } + + let inline _listen f p = + f p.listen <&> fun x -> { p with listen = x } + + let inline _listenPort f p = + f p.listenPort <&> fun x -> { p with listenPort = x } + + let inline _tcpFastOpen f p = + f p.tcpFastOpen <&> fun x -> { p with tcpFastOpen = x } + + let inline _udpFragment f p = + f p.udpFragment <&> fun x -> { p with udpFragment = x } + + let inline _sniff f p = + f p.sniff <&> fun x -> { p with sniff = x } + + let inline _sniffOverrideDestination f p = + f p.sniffOverrideDestination + <&> fun x -> { p with sniffOverrideDestination = x } + + let inline _domainStrategy f p = + f p.domainStrategy <&> fun x -> { p with domainStrategy = x } + + let inline _udpTimeout f p = + f p.udpTimeout <&> fun x -> { p with udpTimeout = x } + + let inline _proxyProtocol f p = + f p.proxyProtocol <&> fun x -> { p with proxyProtocol = x } + + let inline _proxyProtocolAcceptNoHeader f p = + f p.proxyProtocolAcceptNoHeader + <&> fun x -> + { p with + proxyProtocolAcceptNoHeader = x } + + let inline _detour f p = + f p.detour <&> fun x -> { p with detour = x } + + let inline _users f p = + f p.users <&> fun x -> { p with users = x } + + let inline _tls f p = f p.tls <&> fun x -> { p with tls = x } + + let inline _setSystemProxy f p = + f p.setSystemProxy <&> fun x -> { p with setSystemProxy = x } + +type MixedRecord = + { tag: string + + listen: string + listenPort: int16 option + tcpFastOpen: bool option + udpFragment: bool option + sniff: bool option + sniffOverrideDestination: bool option + domainStrategy: string option + udpTimeout: int option + proxyProtocol: bool option + proxyProtocolAcceptNoHeader: bool option + detour: string option + + users: obj list option + setSystemProxy: bool option } + +module MixedRecord = + let inline tag_ f p = f p.tag <&> fun x -> { p with tag = x } + + let inline _listen f p = + f p.listen <&> fun x -> { p with listen = x } + + let inline _listenPort f p = + f p.listenPort <&> fun x -> { p with listenPort = x } + + let inline _tcpFastOpen f p = + f p.tcpFastOpen <&> fun x -> { p with tcpFastOpen = x } + + let inline _udpFragment f p = + f p.udpFragment <&> fun x -> { p with udpFragment = x } + + let inline _sniff f p = + f p.sniff <&> fun x -> { p with sniff = x } + + let inline _sniffOverrideDestination f p = + f p.sniffOverrideDestination + <&> fun x -> { p with sniffOverrideDestination = x } + + let inline _domainStrategy f p = + f p.domainStrategy <&> fun x -> { p with domainStrategy = x } + + let inline _udpTimeout f p = + f p.udpTimeout <&> fun x -> { p with udpTimeout = x } + + let inline _proxyProtocol f p = + f p.proxyProtocol <&> fun x -> { p with proxyProtocol = x } + + let inline _proxyProtocolAcceptNoHeader f p = + f p.proxyProtocolAcceptNoHeader + <&> fun x -> + { p with + proxyProtocolAcceptNoHeader = x } + + let inline _detour f p = + f p.detour <&> fun x -> { p with detour = x } + + let inline _users f p = + f p.users <&> fun x -> { p with users = x } + + let inline _setSystemProxy f p = + f p.setSystemProxy <&> fun x -> { p with setSystemProxy = x } + +type TunStack = + | System + | GVisor // not included by default + | Mixed + | Lwip // upstream archived + +type TunRecord = + { tag: string + interfaceName: string option + inet4Address: string + inet6Address: string option + mtu: int option + autoRoute: bool option + strictRoute: bool option + inet4RouteAddress: string list option + inet6RouteAddress: string list option + endpointIndependentNat: bool option + udpTimeout: int option + stack: TunStack option + includeInterface: string list option + excludeInterface: string list option + includeUid: int list option + includeUidRange: string list option + excludeUid: int list option + excludeUidRange: string list option + includeAndroidUser: int list option + includePackage: string list option + excludePackage: string list option + platform: obj option + + listen: string + listenPort: int16 option + tcpFastOpen: bool option + udpFragment: bool option + sniff: bool option + sniffOverrideDestination: bool option + domainStrategy: string option + proxyProtocol: bool option + proxyProtocolAcceptNoHeader: bool option + detour: string option } + +module TunRecord = + let inline _tag f p = f p.tag <&> fun x -> { p with tag = x } + + let inline _interfaceName f p = + f p.interfaceName <&> fun x -> { p with interfaceName = x } + + let inline _endpointIndependentNat f p = + f p.endpointIndependentNat <&> fun x -> { p with endpointIndependentNat = x } + + let inline _udpTimeout f p = + f p.udpTimeout <&> fun x -> { p with udpTimeout = x } + + let inline _stack f p = + f p.stack <&> fun x -> { p with stack = x } + + let inline _includeInterface f p = + f p.includeInterface <&> fun x -> { p with includeInterface = x } + + let inline _excludeInterface f p = + f p.excludeInterface <&> fun x -> { p with excludeInterface = x } + + let inline _includeUid f p = + f p.includeUid <&> fun x -> { p with includeUid = x } + + let inline _includeUidRange f p = + f p.includeUidRange <&> fun x -> { p with includeUidRange = x } + + let inline _excludeUid f p = + f p.excludeUid <&> fun x -> { p with excludeUid = x } + + let inline _excludeUidRange f p = + f p.excludeUidRange <&> fun x -> { p with excludeUidRange = x } + + let inline _includeAndroidUser f p = + f p.includeAndroidUser <&> fun x -> { p with includeAndroidUser = x } + + let inline _includePackage f p = + f p.includePackage <&> fun x -> { p with includePackage = x } + + let inline _excludePackage f p = + f p.excludePackage <&> fun x -> { p with excludePackage = x } + + let inline _platform f p = + f p.platform <&> fun x -> { p with platform = x } + + let inline _listen f p = + f p.listen <&> fun x -> { p with listen = x } + + let inline _listenPort f p = + f p.listenPort <&> fun x -> { p with listenPort = x } + + let inline _tcpFastOpen f p = + f p.tcpFastOpen <&> fun x -> { p with tcpFastOpen = x } + + let inline _udpFragment f p = + f p.udpFragment <&> fun x -> { p with udpFragment = x } + + let inline _sniff f p = + f p.sniff <&> fun x -> { p with sniff = x } + + let inline _sniffOverrideDestination f p = + f p.sniffOverrideDestination + <&> fun x -> { p with sniffOverrideDestination = x } + + let inline _domainStrategy f p = + f p.domainStrategy <&> fun x -> { p with domainStrategy = x } + + let inline _proxyProtocol f p = + f p.proxyProtocol <&> fun x -> { p with proxyProtocol = x } + + let inline _proxyProtocolAcceptNoHeader f p = + f p.proxyProtocolAcceptNoHeader + <&> fun x -> + { p with + proxyProtocolAcceptNoHeader = x } + + let inline _detour f p = + f p.detour <&> fun x -> { p with detour = x } diff --git a/Aurum.Configuration/Sing/Outbound.fs b/Aurum.Configuration/Sing/Outbound.fs new file mode 100644 index 0000000..e453819 --- /dev/null +++ b/Aurum.Configuration/Sing/Outbound.fs @@ -0,0 +1,279 @@ +module Aurum.Configuration.Sing.Outbound + +open Aurum.Configuration.Shared.Adapter +open System.Text.Json.Serialization +open System.Collections.Generic +open FSharpPlus.Lens + +[] +type MultiplexProtocol = + | Smux + | Yamux + | H2mux + +type MultiplexRecord = + { enabled: bool + protocol: MultiplexProtocol option + maxConnections: int option + minStreams: int option + maxStreams: int option + padding: bool option } + +module MultiplexRecord = + let inline _enabled f p = + f p.enabled <&> fun x -> { p with enabled = x } + + let inline _protocol f p = + f p.protocol <&> fun x -> { p with protocol = x } + + let inline _maxConnections f p = + f p.maxConnections <&> fun x -> { p with maxConnections = x } + + let inline _minStreams f p = + f p.minStreams <&> fun x -> { p with minStreams = x } + + let inline _maxStreams f p = + f p.maxStreams <&> fun x -> { p with maxStreams = x } + + let inline _padding f p = + f p.padding <&> fun x -> { p with padding = x } + +type DirectRecord = + { tag: string + + overrideAddress: string + overridePort: int16 + proxyProtocol: int + + detour: string option + bindInterface: string option + bindAddress: string option + routingMark: int option + reuseAddr: bool option + connectTimeout: string option + tcpFastOpen: bool option + domainStrategy: string option + fallbackDelay: string option } + +module DirectRecord = + let inline _tag f p = f p.tag <&> fun x -> { p with tag = x } + + let inline _overrideAddress f p = + f p.overrideAddress <&> fun x -> { p with overrideAddress = x } + + let inline _overridePort f p = + f p.overridePort <&> fun x -> { p with overridePort = x } + + let inline _proxyProtocol f p = + f p.proxyProtocol <&> fun x -> { p with proxyProtocol = x } + + let inline _detour f p = + f p.detour <&> fun x -> { p with detour = x } + + let inline _bindInterface f p = + f p.bindInterface <&> fun x -> { p with bindInterface = x } + + let inline _bindAddress f p = + f p.bindAddress <&> fun x -> { p with bindAddress = x } + + let inline _routingMark f p = + f p.routingMark <&> fun x -> { p with routingMark = x } + + let inline _reuseAddr f p = + f p.reuseAddr <&> fun x -> { p with reuseAddr = x } + + let inline _connectTimeout f p = + f p.connectTimeout <&> fun x -> { p with connectTimeout = x } + + let inline _tcpFastOpen f p = + f p.tcpFastOpen <&> fun x -> { p with tcpFastOpen = x } + + let inline _domainStrategy f p = + f p.domainStrategy <&> fun x -> { p with domainStrategy = x } + + let inline _fallbackDelay f p = + f p.fallbackDelay <&> fun x -> { p with fallbackDelay = x } + +type BlockRecord = { tag: string } + +module BlockRecord = + let inline _tag f p = f p.tag <&> fun x -> { p with tag = x } + +type ShadowsocksRecord = + { tag: string + + server: string + serverPort: int16 + method: string + password: string + network: string option + udpOverTcp: obj option + multiplex: MultiplexRecord option + + detour: string option + bindInterface: string option + bindAddress: string option + routingMark: int option + reuseAddr: bool option + connectTimeout: string option + tcpFastOpen: bool option + domainStrategy: string option + fallbackDelay: string option } + +module ShadowsocksRecord = + let inline _tag f p = f p.tag <&> fun x -> { p with tag = x } + + let inline _server f p = + f p.server <&> fun x -> { p with server = x } + + let inline _serverPort f p = + f p.serverPort <&> fun x -> { p with serverPort = x } + + let inline _method f p = + f p.method <&> fun x -> { p with method = x } + + let inline _password f p = + f p.password <&> fun x -> { p with password = x } + + let inline _network f p = + f p.network <&> fun x -> { p with network = x } + + let inline _udpOverTcp f p = + f p.udpOverTcp <&> fun x -> { p with udpOverTcp = x } + + let inline _multiplex f p = + f p.multiplex <&> fun x -> { p with multiplex = x } + + let inline _detour f p = + f p.detour <&> fun x -> { p with detour = x } + + let inline _bindInterface f p = + f p.bindInterface <&> fun x -> { p with bindInterface = x } + + let inline _bindAddress f p = + f p.bindAddress <&> fun x -> { p with bindAddress = x } + + let inline _routingMark f p = + f p.routingMark <&> fun x -> { p with routingMark = x } + + let inline _reuseAddr f p = + f p.reuseAddr <&> fun x -> { p with reuseAddr = x } + + let inline _connectTimeout f p = + f p.connectTimeout <&> fun x -> { p with connectTimeout = x } + + let inline _tcpFastOpen f p = + f p.tcpFastOpen <&> fun x -> { p with tcpFastOpen = x } + + let inline _domainStrategy f p = + f p.domainStrategy <&> fun x -> { p with domainStrategy = x } + + let inline _fallbackDelay f p = + f p.fallbackDelay <&> fun x -> { p with fallbackDelay = x } + +type HttpTransport = + { host: string list + path: string + method: string + headers: Dictionary + idleTimeout: string + pingTimeout: string } + +type WebSocketTransport = + { path: string + headers: Dictionary + maxEarlyData: int + earlyDataHeaderName: string } + +type GrpcTransport = + { serviceName: string + idleTimeout: string + pingTimeout: string + permitWithoutStream: bool } + +type V2RayTransport = + | HTTP of HttpTransport + | WebSocket of WebSocketTransport + | QUIC + | GRPC of GrpcTransport + +[] +type V2RayPaketEncoding = + | [] None + | [] PaketAddr + | [] Xudp + +type VMessRecord = + { tag: string + + server: string + serverPort: int16 + security: string option + uuid: string + alterId: int option + globalPadding: bool option + authenticatedLength: bool option + network: string option + paketEncoding: V2RayPaketEncoding option + multiplex: MultiplexRecord option + transport: V2RayTransport + + detour: string option + bindInterface: string option + bindAddress: string option + routingMark: int option + reuseAddr: bool option + connectTimeout: string option + tcpFastOpen: bool option + domainStrategy: string option + fallbackDelay: string option } + + static member FromV2FlyObject v2flyObject = () + +module VMessRecord = + let inline _tag f p = f p.tag <&> fun x -> { p with tag = x } + + let inline _server f p = + f p.server <&> fun x -> { p with server = x } + + let inline _serverPort f p = + f p.serverPort <&> fun x -> { p with serverPort = x } + + let inline _security f p = + f p.security <&> fun x -> { p with security = x } + + let inline _uuid f p = + f p.uuid <&> fun x -> { p with uuid = x } + + let inline _network f p = + f p.network <&> fun x -> { p with network = x } + + let inline _multiplex f p = + f p.multiplex <&> fun x -> { p with multiplex = x } + +type SelectorRecord = + { tag: string + + outbounds: string list + [] + defaultOutbound: string option } + +module SelectorRecord = + let inline _tag f p = f p.tag <&> fun x -> { p with tag = x } + + let inline _outbounds f p = + f p.outbounds <&> fun x -> { p with outbounds = x } + + let inline _defaultOutbound f p = + f p.defaultOutbound <&> fun x -> { p with defaultOutbound = x } + +type Outbounds = + | Direct of DirectRecord + | Block of BlockRecord + | SOCKS of obj // SOCKSRecord + | HTTP of obj // HTTPRecord + | Shadowsocks of ShadowsocksRecord + | VMess of VMessRecord + | Selector of SelectorRecord + + static member FromSharedAdapters sharedAdapter = () diff --git a/Aurum.Configuration/Sing/Routing.fs b/Aurum.Configuration/Sing/Routing.fs new file mode 100644 index 0000000..3d30285 --- /dev/null +++ b/Aurum.Configuration/Sing/Routing.fs @@ -0,0 +1,198 @@ +module Aurum.Configuration.Sing.Routing + +open System.Text.Json.Serialization +open Aurum.Configuration.Shared +open Aurum.Configuration.Shared.Routing + +type IpVersion = + | [] IpV4 + | [] IpV6 + +type NetworkType = + | [] TCP + | [] UDP + + static member FromRuleMatchNetwork(ruleMatchNetwork: RuleMatchNetwork option) = + Option.map + (fun inp -> + match inp with + | RuleMatchNetwork.TCP -> [ TCP ] + | RuleMatchNetwork.UDP -> [ UDP ] + | RuleMatchNetwork.TCPAndUDP -> [ TCP; UDP ]) + ruleMatchNetwork + +type RuleObject = + { inbound: string list option + ipVersion: IpVersion option + network: NetworkType list option + authUser: string list option + protocol: RuleMatchProtocol list option + domain: string list option + domainSuffix: string list option + domainKeyword: string list option + domainRegex: string list option + geosite: string list option + geoip: string list option + ipCidr: string list option + port: int list option + processName: string list option + processPath: string list option + packageName: string list option + user: string list option + userId: string list option + clashMode: string option + invert: bool option + outbound: string } + + static member FromGenericRuleObject(genericRuleObject: Routing.RuleObject) = + let ipList = + genericRuleObject.Ip + |> Option.map (fun inp -> + inp + |> List.choose (fun x -> + match x with + | Ip ip -> Some ip + | _ -> None)) + + let geoipList = + genericRuleObject.Ip + |> Option.map (fun inp -> + inp + |> List.choose (fun x -> + match x with + | Geoip code -> Some code + | _ -> None)) + + let domainList = + genericRuleObject.Domain + |> Option.map (fun inp -> + inp + |> List.choose (fun x -> + match x with + | Domain domainType -> + match domainType with + | Full domain -> Some domain + | _ -> None + | _ -> None)) + + let domainSuffixList = + genericRuleObject.Domain + |> Option.map (fun inp -> + inp + |> List.choose (fun x -> + match x with + | Domain domainType -> + match domainType with + | Suffix domain -> Some domain + | _ -> None + | _ -> None)) + + let domainRegexList = + genericRuleObject.Domain + |> Option.map (fun inp -> + inp + |> List.choose (fun x -> + match x with + | Domain domainType -> + match domainType with + | Regex domain -> Some domain + | _ -> None + | _ -> None)) + + let domainKeywordList = + genericRuleObject.Domain + |> Option.map (fun inp -> + inp + |> List.choose (fun x -> + match x with + | Domain domainType -> + match domainType with + | Keyword domain -> Some domain + | _ -> None + | _ -> None)) + + let geositeList = + genericRuleObject.Domain + |> Option.map (fun inp -> + inp + |> List.choose (fun x -> + match x with + | Geosite code -> Some code + | _ -> None)) + + { inbound = genericRuleObject.InboundTag + ipVersion = None + network = NetworkType.FromRuleMatchNetwork genericRuleObject.Networks + authUser = None + protocol = None + domain = domainList + domainSuffix = domainSuffixList + domainKeyword = domainKeywordList + domainRegex = domainRegexList + geosite = geositeList + geoip = geoipList + ipCidr = ipList + port = None + processName = None + processPath = None + packageName = None + user = None + userId = None + clashMode = None + invert = None + outbound = genericRuleObject.Tag } + +module RuleObject = + let inline _inbound f p = + f p.inbound <&> fun x -> { p with inbound = x } + + let inline _ipVersion f p = + f p.ipVersion <&> fun x -> { p with ipVersion = x } + + let inline _network f p = + f p.network <&> fun x -> { p with network = x } + + let inline _authUser f p = + f p.authUser <&> fun x -> { p with authUser = x } + + let inline _protocol f p = + f p.protocol <&> fun x -> { p with protocol = x } + + let inline _domainKeyword f p = + f p.domainKeyword <&> fun x -> { p with domainKeyword = x } + + let inline _domainRegex f p = + f p.domainRegex <&> fun x -> { p with domainRegex = x } + + let inline _geoip f p = + f p.geoip <&> fun x -> { p with geoip = x } + + let inline _ipCidr f p = + f p.ipCidr <&> fun x -> { p with ipCidr = x } + + let inline _port f p = + f p.port <&> fun x -> { p with port = x } + + let inline _processName f p = + f p.processName <&> fun x -> { p with processName = x } + + let inline _processPath f p = + f p.processPath <&> fun x -> { p with processPath = x } + + let inline _packageName f p = + f p.packageName <&> fun x -> { p with packageName = x } + + let inline _user f p = + f p.user <&> fun x -> { p with user = x } + + let inline _userId f p = + f p.userId <&> fun x -> { p with userId = x } + + let inline _clashMode f p = + f p.clashMode <&> fun x -> { p with clashMode = x } + + let inline _invert f p = + f p.invert <&> fun x -> { p with invert = x } + + let inline _outbound f p = + f p.outbound <&> fun x -> { p with outbound = x } diff --git a/Aurum.Configuration/Sing/Shared.fs b/Aurum.Configuration/Sing/Shared.fs new file mode 100644 index 0000000..34b471c --- /dev/null +++ b/Aurum.Configuration/Sing/Shared.fs @@ -0,0 +1,39 @@ +module Aurum.Configuration.Sing.Shared + + +type TLSOutbound = + { enabled: bool + disableSNI: bool option + serverName: string option + insecure: bool option + alpn: string list option + minVersion: string option + maxVersion: string option + cipherSuites: string list option + certificate: string option + certificatePath: string option } + +type ACMERecord = + { domain: string list + dataDirectory: string + defaultServerName: string + email: string + provider: string option + disableHTTPChallenge: bool option + disableTlsAlpnChallenge: bool option + alternativeHTTPPort: int option + alternativeTLSPort: int option + externalAccount: obj option } + +type TLSInbound = + { enabled: bool + serverName: string option + alpn: string list option + minVersion: string option + maxVersion: string option + cipherSuites: string list option + certificate: string option + certificatePath: string option + key: string option + keyPath: string option + acme: ACMERecord } diff --git a/Aurum.Configuration/SubscriptionAdapter/OOCv1.fs b/Aurum.Configuration/SubscriptionAdapter/OOCv1.fs new file mode 100644 index 0000000..a01b5aa --- /dev/null +++ b/Aurum.Configuration/SubscriptionAdapter/OOCv1.fs @@ -0,0 +1,7 @@ +module Aurum.Configuration.SubscriptionAdapter.OOCv1 + +type OocApiToken = + { version: int + baseUrl: string + secret: string + userId: string } diff --git a/Aurum.Configuration/SubscriptionAdapter/V2rayNBase64.fs b/Aurum.Configuration/SubscriptionAdapter/V2rayNBase64.fs new file mode 100644 index 0000000..8cf0f09 --- /dev/null +++ b/Aurum.Configuration/SubscriptionAdapter/V2rayNBase64.fs @@ -0,0 +1,10 @@ +module Aurum.Configuration.SubscriptionAdapter.V2rayNBase64 + +open Aurum + +let extractShareLinks content = + let decodedBase64 = decodeBase64 content + + decodedBase64.Split "\n" + |> List.ofArray + |> List.map (fun link -> link.Substring 8) diff --git a/Aurum.Configuration/V2fly/Base.fs b/Aurum.Configuration/V2fly/Base.fs new file mode 100644 index 0000000..9e935be --- /dev/null +++ b/Aurum.Configuration/V2fly/Base.fs @@ -0,0 +1,29 @@ +module Aurum.Configuration.V2fly.Base + +open Aurum.Configuration.V2fly.Inbound +open Aurum.Configuration.V2fly.Outbound +open Aurum.Configuration.V2fly.Routing + +type LogLevel = + | Debug + | Info + | Warning + | Error + | None + +type LogObject = + { Access: string option + Error: string option + Loglevel: LogLevel } + + static member Access_ = (fun a -> a.Access), (fun b a -> { a with Access = b }) + + static member Error_ = (fun a -> a.Error), (fun b a -> { a with Error = b }) + + static member Loglevel_ = (fun a -> a.Loglevel), (fun b a -> { a with Loglevel = b }) + +type V2flyBaseConfiguration = + { Log: LogObject + Routing: RoutingObject + Inbounds: InboundObject list + Outbounds: OutboundObject list } diff --git a/Aurum.Configuration/V2fly/Inbound.fs b/Aurum.Configuration/V2fly/Inbound.fs new file mode 100644 index 0000000..9c50cf3 --- /dev/null +++ b/Aurum.Configuration/V2fly/Inbound.fs @@ -0,0 +1,124 @@ +module Aurum.Configuration.V2fly.Inbound + +open System.Text.Json.Serialization + +type Protocols = + | [] HTTP + | [] Socks + | [] DokodemoDoor + +type SocksAuth = + | [] NoAuth + | [] Password + +type DestinationOverride = + | [] HTTP + | [] TLS + | [] FakeDNS + | [] FakeDNSOthers + +type AccountObject = { User: string; Pass: string } + +type InboundConfigurationObject = + { Accounts: AccountObject list option + UserLevel: int option + Timeout: int option + (*HTTP specific*) + AllowTransparent: bool option + (*SOCKS specific*) + Auth: SocksAuth option + UDP: bool option + IP: string option + (*Dokodemo-door specific*) + Address: string option + Port: int option + Network: string option + FollowRedirect: bool option } + +// stub object (reserved) +type SocksInboundConfigurationObject = + { Accounts: AccountObject list option + UserLevel: int option + Timeout: int option + Auth: SocksAuth option + UDP: bool option + IP: string option } + +// stub object (reserved) +type DokodemoDoorInboundConfigurationObject = + { Accounts: AccountObject list option + UserLevel: int option + Timeout: int option + Address: string option + Port: int option + Network: string option + FollowRedirect: bool option } + +type SniffingObject = + { Enabled: bool + DestOverride: DestinationOverride list + MetadataOnly: bool } + +type InboundObject = + { Listen: string + Port: int + Protocol: Protocols + Settings: InboundConfigurationObject + Tag: string + Sniffing: SniffingObject } + +let createSocksAccount (user, pass) = + { AccountObject.User = user + Pass = pass } + +let createSocksInboundObject (auth, accounts, udp, ip, userLevel) = + { InboundConfigurationObject.Auth = auth + Accounts = accounts + UserLevel = userLevel + UDP = udp + IP = ip + Timeout = None + AllowTransparent = None + Address = None + Port = None + Network = None + FollowRedirect = None } + +let createHttpInboundObject (timeout, accounts, allowTransparent, userLevel) = + { InboundConfigurationObject.Auth = None + Accounts = accounts + UserLevel = userLevel + UDP = None + IP = None + Timeout = timeout + AllowTransparent = allowTransparent + Address = None + Port = None + Network = None + FollowRedirect = None } + +let createDokodemoDoorInboundObject (address, port, network, timeout, followRedirect, userLevel) = + { InboundConfigurationObject.Auth = None + Accounts = None + UserLevel = userLevel + UDP = None + IP = None + Timeout = timeout + AllowTransparent = None + Address = address + Port = port + Network = network + FollowRedirect = followRedirect } + +let createSniffingObject (enabled, destinationOverride, metadataOnly) = + { SniffingObject.Enabled = enabled + DestOverride = destinationOverride + MetadataOnly = metadataOnly } + +let createInboundObject (allowLocalConnection, port, protocol, settings, sniffing, tag) = + { InboundObject.Listen = if allowLocalConnection then "0.0.0.0" else "127.0.0.1" + Port = port + Protocol = protocol + Settings = settings + Sniffing = sniffing + Tag = Option.defaultValue "Default" tag } diff --git a/Aurum.Configuration/V2fly/Outbound.fs b/Aurum.Configuration/V2fly/Outbound.fs new file mode 100644 index 0000000..303b936 --- /dev/null +++ b/Aurum.Configuration/V2fly/Outbound.fs @@ -0,0 +1,159 @@ +module Aurum.Configuration.V2fly.Outbound + +open System.Text.Json.Serialization +open Aurum +open Aurum.Configuration.Shared +open Aurum.Configuration.Shared.Adapter +open Aurum.Configuration.Shared.V2fly +open Aurum.Configuration.Shared.Shadowsocks + +[] +type ShadowsocksEncryption = + | [] None + | [] Plain + | [] ChaCha20 + | [] ChaCha20Ietf + | [] AES128 + | [] AES256 + +type V2flyShadowsocksObject = + { Address: string + Port: int + Method: ShadowsocksEncryption + Password: string } + + static member FromGenericShadowsocksObject(genericShadowsocksObject: ShadowsocksObject) = + let method, password = + match genericShadowsocksObject.Encryption with + | Shadowsocks.ShadowsocksEncryption.None -> ShadowsocksEncryption.None, "" + | Shadowsocks.ShadowsocksEncryption.Plain -> ShadowsocksEncryption.Plain, "" + | Shadowsocks.ShadowsocksEncryption.AES128 password -> ShadowsocksEncryption.AES128, password + | Shadowsocks.ShadowsocksEncryption.AES256 password -> ShadowsocksEncryption.AES256, password + | Shadowsocks.ShadowsocksEncryption.ChaCha20 password -> ShadowsocksEncryption.ChaCha20, password + | Shadowsocks.ShadowsocksEncryption.ChaCha20Ietf password -> ShadowsocksEncryption.ChaCha20Ietf, password + | encryption -> raise (ConfigurationParameterException $"unsupported Shadowsocks encryption ${encryption}") + + { Address = genericShadowsocksObject.Host + Port = genericShadowsocksObject.Port + Method = method + Password = password } + +type OutboundProtocols = + | VMess of VMessObject + | VLESS of obj + | VLite of obj + | Shadowsocks of V2flyShadowsocksObject + | Trojan of obj + +type OutboundObject = + { SendThrough: string option + Settings: OutboundProtocols + Tag: string + StreamSettings: StreamSettings option + Mux: MuxObject option } + + static member ParseGenericShadowsocksPlugin(genericConfiguration: ShadowsocksObject) = + genericConfiguration.Plugin + |> Option.map (fun inp -> + match inp with + | SimpleObfs _ -> raise (ConfigurationParameterException "simple-obfs plugin is unsupported by v2ray") + | V2ray opt -> + let options = opt.Split(";") |> Array.toList + + if options.Length = 0 then + let transportSettings = createWebSocketObject None None None None None None + + { TransportSettings = transportSettings + SecuritySettings = TransportSecurity.None } + elif options |> List.contains "tls" then + let host = (options |> List.find (fun a -> a.IndexOf("host") <> -1)).Split("=")[1] + + let transportSettings = createWebSocketObject None None None (Some host) None None + + let securitySettings = createTLSObject (Some host) None + + { TransportSettings = transportSettings + SecuritySettings = securitySettings } + elif options |> List.exists (fun a -> a.IndexOf("mode") <> -1) then + let host = (options |> List.find (fun a -> a.IndexOf("host") <> -1)).Split("=")[1] + let transportSettings = createQuicObject () + let securitySettings = createTLSObject (Some host) None + + { TransportSettings = transportSettings + SecuritySettings = securitySettings } + else + raise (ConfigurationParameterException $"unknown Shadowsocks v2ray-plugin options '{opt}'")) + + static member FromGenericConfigurationObject(tag, genericConfiguration: ConfigurationFamily) = + match genericConfiguration with + | V2fly settings -> + match settings.Protocol with + | Protocols.VMess protocolSettings -> + { OutboundObject.SendThrough = None + Settings = VMess protocolSettings + Tag = tag + StreamSettings = Some settings.StreamSettings + Mux = None } + | Protocols.VLESS -> + { OutboundObject.SendThrough = None + Settings = VLESS {| |} // this is a stub. VLESS support will be implemented later + Tag = tag + StreamSettings = Some settings.StreamSettings + Mux = None } + | ConfigurationFamily.Shadowsocks settings -> + { OutboundObject.SendThrough = None + Settings = V2flyShadowsocksObject.FromGenericShadowsocksObject settings |> Shadowsocks + Tag = tag + StreamSettings = OutboundObject.ParseGenericShadowsocksPlugin settings + Mux = None } + +type OutboundJsonObject = + { SendThrough: string option + Protocol: string + Settings: obj + Tag: string + StreamSettings: StreamSettings option + Mux: MuxObject option } + + static member FromOutboundObject(outboundObject: OutboundObject) = + let protocol, (settings: obj) = + match outboundObject.Settings with + | VMess setting -> "vmess", setting + | VLESS setting -> "vless", setting + | VLite setting -> "vlite", setting + | Shadowsocks setting -> "shadowsocks", setting + | Trojan setting -> "trojan", setting + + { SendThrough = outboundObject.SendThrough + Protocol = protocol + Settings = settings + Tag = outboundObject.Tag + StreamSettings = outboundObject.StreamSettings + Mux = outboundObject.Mux } + + member this.ToOutboundObject() = + let settings = // this process is error-prone, but there is no choice since FSharp.SystemTextJson does not have support for unwrapping records onto its upper-layer records. + match this.Protocol with + | "vmess" -> VMess(downcast this.Settings) |> Ok + | "vless" -> VLESS(downcast this.Settings) |> Ok + | "vlite" -> VLite(downcast this.Settings) |> Ok + | "shadowsocks" -> Shadowsocks(downcast this.Settings) |> Ok + | "trojan" -> Trojan(downcast this.Settings) |> Ok + | _ -> Error(ConfigurationParameterException $"unknown protocol type '{this.Protocol}'") + + match settings with + | Ok settings -> + { OutboundObject.SendThrough = this.SendThrough + Settings = settings + Tag = this.Tag + StreamSettings = this.StreamSettings + Mux = this.Mux } + |> Ok + | Error e -> Error e + +let createV2flyOutboundObject sendThrough setting streamSetting tag mux = + { OutboundObject.SendThrough = sendThrough + StreamSettings = streamSetting + Settings = setting + Mux = mux + Tag = tag } diff --git a/Aurum.Configuration/V2fly/Routing.fs b/Aurum.Configuration/V2fly/Routing.fs new file mode 100644 index 0000000..401bf38 --- /dev/null +++ b/Aurum.Configuration/V2fly/Routing.fs @@ -0,0 +1,121 @@ +module Aurum.Configuration.V2fly.Routing + +open Aurum +open Aurum.Configuration.Shared +open Aurum.Configuration.Shared.Routing +open System.Text.Json.Serialization + +type DomainStrategy = + | [] AsIs + | [] IPIfNonMatch + | [] IPOnDemand + +type DomainMatcher = + | [] MinimalPerfectHash + | [] Original + +type RuleMatchProtocol = + | [] HTTP + | [] TLS + +[] +type DomainObject = + | Plain of string + | Regex of string + | RootDomain of string + | Full of string + +type GeoDataObject = + { InverseMatch: bool option + Code: string option + FilePath: string option } + +type CidrObject = { IpAddr: string; Prefix: int } + +let createGeoDataObject (code, filepath) = + { InverseMatch = None + Code = Some code + FilePath = filepath } + +let mapDomainMatchingType domainMatchingType = + match domainMatchingType with + | DomainMatchingType.Full str -> Full str + | DomainMatchingType.Regex str -> Regex str + | Keyword str -> Plain str + | Suffix str -> RootDomain str + +let parseCidrString (cidrString: string) = + let cidrStringParts = cidrString.Split("/") + + { IpAddr = cidrStringParts[0] + Prefix = System.Int32.Parse(cidrStringParts[1]) } + +type RuleObject = + { Tag: string + Domain: DomainObject list option + GeoDomain: GeoDataObject list option + Ip: CidrObject list option + GeoIp: GeoDataObject list option + Networks: RuleMatchNetwork option + PortList: string option + InboundTag: string list option } + + static member FromGenericRuleObject(genericRuleObject: Routing.RuleObject) = + let ipList = + genericRuleObject.Ip + |> Option.map (fun imp -> + imp + |> List.choose (fun x -> + match x with + | Ip ip -> parseCidrString ip |> Some + | _ -> None)) + |> Option.bind emptyListToNone + + let geoipList = + genericRuleObject.Ip + |> Option.map (fun inp -> + inp + |> List.choose (fun x -> + match x with + | Geoip geoip -> createGeoDataObject (geoip, None) |> Some + | _ -> None)) + |> Option.bind emptyListToNone + + let domainList = + genericRuleObject.Domain + |> Option.map (fun inp -> + inp + |> List.choose (fun entries -> + match entries with + | Domain domainMatchingType -> mapDomainMatchingType domainMatchingType |> Some + | _ -> None)) + |> Option.bind emptyListToNone + + let geositeList = + genericRuleObject.Domain + |> Option.map (fun inp -> + inp + |> List.choose (fun entries -> + match entries with + | Geosite geosite -> createGeoDataObject (geosite, None) |> Some + | _ -> None)) + |> Option.bind emptyListToNone + + { RuleObject.Tag = genericRuleObject.Tag + Domain = domainList + GeoDomain = geositeList + Ip = ipList + GeoIp = geoipList + Networks = genericRuleObject.Networks + PortList = genericRuleObject.Port |> Option.map (fun imp -> System.String.Join(",", imp)) + InboundTag = genericRuleObject.InboundTag } + +type RoutingObject = + { DomainStrategy: DomainStrategy option + DomainMatcher: DomainMatcher option + Rules: RuleObject list option } + +let createRoutingObject rules domainStrategy = + { RoutingObject.Rules = rules + DomainMatcher = Some MinimalPerfectHash + DomainStrategy = domainStrategy } diff --git a/Aurum.Configuration/paket.references b/Aurum.Configuration/paket.references new file mode 100644 index 0000000..12fb713 --- /dev/null +++ b/Aurum.Configuration/paket.references @@ -0,0 +1,5 @@ +FSharp.SystemTextJson +Microsoft.AspNetCore.WebUtilities +Serilog +Nanoid +FSharpPlus diff --git a/Aurum.Configuration/paket.template b/Aurum.Configuration/paket.template new file mode 100644 index 0000000..7eea1b5 --- /dev/null +++ b/Aurum.Configuration/paket.template @@ -0,0 +1,8 @@ +type project +id Aurum.Configuration +version 0.1.0-beta.1 +authors Shanoa Ice +description + Configuration generation component for the Aurum project. +licenseExpression LGPL-3.0-only +repositoryUrl https://github.com/Shadowsocks-NET/Aurum diff --git a/Aurum.DataProtection/Aurum.DataProtection.fsproj b/Aurum.DataProtection/Aurum.DataProtection.fsproj new file mode 100644 index 0000000..2862f9a --- /dev/null +++ b/Aurum.DataProtection/Aurum.DataProtection.fsproj @@ -0,0 +1,24 @@ + + + + net7.0 + true + Aurum.DataProtection + 0.1.0-beta.1 + Shanoa Ice + Data Protection Component for the Aurum project. + git + https://github.com/Shadowsocks-NET/Aurum + + + true + true + true + + + + + + + + diff --git a/Aurum.DataProtection/Windows.fs b/Aurum.DataProtection/Windows.fs new file mode 100644 index 0000000..2f603ef --- /dev/null +++ b/Aurum.DataProtection/Windows.fs @@ -0,0 +1,21 @@ +namespace Aurum.DataProtection + +module Windows = + let encryptString (data: string) = + let rawBytes = System.Text.Encoding.UTF8.GetBytes data + + System.Security.Cryptography.ProtectedData.Protect( + rawBytes, + null, + System.Security.Cryptography.DataProtectionScope.CurrentUser + ) + + let decryptString protectedData = + let decryptedBytes = + System.Security.Cryptography.ProtectedData.Unprotect( + protectedData, + null, + System.Security.Cryptography.DataProtectionScope.CurrentUser + ) + + System.Text.Encoding.UTF8.GetString decryptedBytes diff --git a/Aurum.DataProtection/paket.references b/Aurum.DataProtection/paket.references new file mode 100644 index 0000000..e813748 --- /dev/null +++ b/Aurum.DataProtection/paket.references @@ -0,0 +1,2 @@ +FSharp.Core +System.Security.Cryptography.ProtectedData diff --git a/Aurum.DataProtection/paket.template b/Aurum.DataProtection/paket.template new file mode 100644 index 0000000..ea1aa35 --- /dev/null +++ b/Aurum.DataProtection/paket.template @@ -0,0 +1,8 @@ +type project +id Aurum.DataProtection +version 0.1.0-beta.1 +authors Shanoa Ice +description + Data protection component for the Aurum project. +licenseExpression LGPL-3.0-only +repositoryUrl https://github.com/Shadowsocks-NET/Aurum diff --git a/Aurum.Filesystem/Aurum.Filesystem.fsproj b/Aurum.Filesystem/Aurum.Filesystem.fsproj new file mode 100644 index 0000000..54e9848 --- /dev/null +++ b/Aurum.Filesystem/Aurum.Filesystem.fsproj @@ -0,0 +1,23 @@ + + + + net7.0 + true + Aurum.Filesystem + 0.1.0-beta.1 + Shanoa Ice + Filesystem Related Component for the Aurum project. + git + https://github.com/Shadowsocks-NET/Aurum + Aurum.Filesystem + + + + + + + + + + + diff --git a/Aurum.Filesystem/paket.references b/Aurum.Filesystem/paket.references new file mode 100644 index 0000000..8888236 --- /dev/null +++ b/Aurum.Filesystem/paket.references @@ -0,0 +1,2 @@ +FSharp.Core +FSharpPlus diff --git a/Aurum.Filesystem/paket.template b/Aurum.Filesystem/paket.template new file mode 100644 index 0000000..a64355e --- /dev/null +++ b/Aurum.Filesystem/paket.template @@ -0,0 +1,8 @@ +type project +id Aurum.AssetManagement +version 0.1.0-alpha.1 +authors Shanoa Ice +description + Asset Management component of the Aurum project. +licenseExpression LGPL-3.0-only +repositoryUrl https://github.com/Shadowsocks-NET/Aurum diff --git a/Aurum.Interop/Aurum.Interop.fsproj b/Aurum.Interop/Aurum.Interop.fsproj new file mode 100644 index 0000000..58bcda0 --- /dev/null +++ b/Aurum.Interop/Aurum.Interop.fsproj @@ -0,0 +1,20 @@ + + + + net7.0 + true + Aurum.Interop + 0.1.0-beta.1 + Shanoa Ice + Process Interop Component for the Aurum project. + git + https://github.com/Shadowsocks-NET/Aurum + + + + + + + + + diff --git a/Aurum.Interop/LogStream.fs b/Aurum.Interop/LogStream.fs new file mode 100644 index 0000000..bf4df33 --- /dev/null +++ b/Aurum.Interop/LogStream.fs @@ -0,0 +1,35 @@ +module Aurum.Interop.LogStream + +open System.Text.RegularExpressions +open FSharp.Control.Reactive + +type LogEntry = + | General of string + | Error of string + | Warning of string + | Info of string + | Debug of string + +let matchLog logContent = + let regexMatcher = Regex(@"\[(Debug|Info|Warning|Error)\]") + let result = regexMatcher.Match(logContent) + + if not result.Success then + General logContent + else + match result.Captures.[0].Value with + | "Debug" -> Debug logContent + | "Info" -> Info logContent + | "Warning" -> Warning logContent + | "Error" -> Error logContent + | _ -> General logContent + +type LogEvent() = + let event = Event() + + [] + member this.Event = event.Publish + + member this.Trigger(log) = event.Trigger(matchLog log) + +let logStream = LogEvent() diff --git a/Aurum.Interop/ProcessWrapper.fs b/Aurum.Interop/ProcessWrapper.fs new file mode 100644 index 0000000..045fcb0 --- /dev/null +++ b/Aurum.Interop/ProcessWrapper.fs @@ -0,0 +1,61 @@ +// fsharplint:disable FL0065 +module Aurum.Interop.ProcessWrapper + +open System.Diagnostics +open System.Threading + +type CoreProcess + (coreProcessInfo: ProcessStartInfo, loggerTaskBuilder: System.IO.StreamReader -> CancellationToken -> Tasks.Task) + = + let mutable disposed = false + let coreProcessInfo = coreProcessInfo + let cancelLogging = new CancellationTokenSource() + + let mutable internalProcess = new Process() + + interface System.IDisposable with + member this.Dispose() = + if (not disposed) then + cancelLogging.Cancel() + cancelLogging.Dispose() + this.Process.Dispose() + disposed <- false + + member this.Process + with get () = internalProcess + and set (value) = internalProcess <- value + + member this.Start() = + (this.Process <- Process.Start(coreProcessInfo)) + + let loggerTask = loggerTaskBuilder this.Process.StandardOutput cancelLogging.Token + + loggerTask.Start() + () + + member this.Stop() = + cancelLogging.Cancel() + this.Process.Kill(true) + +let startCoreProcess (executablePath, configPath: string, assetPath) = + let coreProcessInfo = + ProcessStartInfo(executablePath, $"-config={configPath} -format=json") + + coreProcessInfo.UseShellExecute <- false + coreProcessInfo.CreateNoWindow <- false + + coreProcessInfo.RedirectStandardError <- true + + coreProcessInfo.RedirectStandardOutput <- true + + assetPath + |> Option.iter (fun a -> coreProcessInfo.Environment.["v2ray.location.asset"] <- a) + + let createCoreLoggerTask (stdout: System.IO.StreamReader) (cancellationToken: CancellationToken) = + backgroundTask { + while (not cancellationToken.IsCancellationRequested) do + let! logLine = stdout.ReadLineAsync() + LogStream.logStream.Trigger logLine + } + + new CoreProcess(coreProcessInfo, createCoreLoggerTask) diff --git a/Aurum.Interop/paket.references b/Aurum.Interop/paket.references new file mode 100644 index 0000000..4d22ed1 --- /dev/null +++ b/Aurum.Interop/paket.references @@ -0,0 +1 @@ +FSharp.Control.Reactive \ No newline at end of file diff --git a/Aurum.Interop/paket.template b/Aurum.Interop/paket.template new file mode 100644 index 0000000..d533f37 --- /dev/null +++ b/Aurum.Interop/paket.template @@ -0,0 +1,8 @@ +type project +id Aurum.Interop +version 0.1.0-beta.1 +authors Shanoa Ice +description + Program interop component library for the Aurum project. +licenseExpression LGPL-3.0-only +repositoryUrl https://github.com/Shadowsocks-NET/Aurum diff --git a/Aurum.Micro/.gitignore b/Aurum.Micro/.gitignore deleted file mode 100644 index d007509..0000000 --- a/Aurum.Micro/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -.idea/ -.vscode/ -.vs/ - -bin/ -obj/ - -*.user \ No newline at end of file diff --git a/Aurum.Micro/App.axaml b/Aurum.Micro/App.axaml deleted file mode 100644 index c534f1d..0000000 --- a/Aurum.Micro/App.axaml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/Aurum.Micro/App.axaml.cs b/Aurum.Micro/App.axaml.cs deleted file mode 100644 index 49c43ee..0000000 --- a/Aurum.Micro/App.axaml.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Diagnostics; -using Aurum.Micro.Services; -using Aurum.Micro.ViewModels; -using Aurum.Micro.Views; -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Markup.Xaml; -using Avalonia.Controls; - -namespace Aurum.Micro -{ - public class App : Application - { - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } - - public override void OnFrameworkInitializationCompleted() - { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - var connections = new Connections(); - - desktop.MainWindow = new MainWindow - { - DataContext = new MainWindowViewModel(connections) - }; - } - } - } -} \ No newline at end of file diff --git a/Aurum.Micro/Assets/Golden_Crystal 256x256.png b/Aurum.Micro/Assets/Golden_Crystal 256x256.png deleted file mode 100644 index 1b9097f..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal 256x256.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Blue_Variant 256x256.png b/Aurum.Micro/Assets/Golden_Crystal_Blue_Variant 256x256.png deleted file mode 100644 index 1b494ae..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Blue_Variant 256x256.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Blue_Variant.png b/Aurum.Micro/Assets/Golden_Crystal_Blue_Variant.png deleted file mode 100644 index f735d15..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Blue_Variant.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Borderless 256x256.png b/Aurum.Micro/Assets/Golden_Crystal_Borderless 256x256.png deleted file mode 100644 index cf994be..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Borderless 256x256.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Borderless 64x64.png b/Aurum.Micro/Assets/Golden_Crystal_Borderless 64x64.png deleted file mode 100644 index 9331e8a..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Borderless 64x64.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Borderless-64x64.ico b/Aurum.Micro/Assets/Golden_Crystal_Borderless-64x64.ico deleted file mode 100644 index 9ca4af7..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Borderless-64x64.ico and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Borderless.png b/Aurum.Micro/Assets/Golden_Crystal_Borderless.png deleted file mode 100644 index 2214755..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Borderless.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Red_Glitches 256x256.png b/Aurum.Micro/Assets/Golden_Crystal_Red_Glitches 256x256.png deleted file mode 100644 index 283564f..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Red_Glitches 256x256.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Red_Glitches.png b/Aurum.Micro/Assets/Golden_Crystal_Red_Glitches.png deleted file mode 100644 index 32a39f2..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Red_Glitches.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Red_Varient 256x256.png b/Aurum.Micro/Assets/Golden_Crystal_Red_Varient 256x256.png deleted file mode 100644 index dce9547..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Red_Varient 256x256.png and /dev/null differ diff --git a/Aurum.Micro/Assets/Golden_Crystal_Red_Varient.png b/Aurum.Micro/Assets/Golden_Crystal_Red_Varient.png deleted file mode 100644 index d07ad17..0000000 Binary files a/Aurum.Micro/Assets/Golden_Crystal_Red_Varient.png and /dev/null differ diff --git a/Aurum.Micro/Assets/avalonia-logo.ico b/Aurum.Micro/Assets/avalonia-logo.ico deleted file mode 100644 index da8d49f..0000000 Binary files a/Aurum.Micro/Assets/avalonia-logo.ico and /dev/null differ diff --git a/Aurum.Micro/Aurum.Micro.csproj b/Aurum.Micro/Aurum.Micro.csproj deleted file mode 100644 index 580e95e..0000000 --- a/Aurum.Micro/Aurum.Micro.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - WinExe - net5.0 - enable - - - - - - - - - - - - diff --git a/Aurum.Micro/Models/ConnectionItem.cs b/Aurum.Micro/Models/ConnectionItem.cs deleted file mode 100644 index 4270975..0000000 --- a/Aurum.Micro/Models/ConnectionItem.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Aurum.Micro.Models -{ - public class ConnectionItem - { - public string ConnectionName { get; set; } - public bool IsConnected { get; set; } - } -} \ No newline at end of file diff --git a/Aurum.Micro/Program.cs b/Aurum.Micro/Program.cs deleted file mode 100644 index 32792b1..0000000 --- a/Aurum.Micro/Program.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.ReactiveUI; - -namespace Aurum.Micro -{ - class Program - { - // Initialization code. Don't use any Avalonia, third-party APIs or any - // SynchronizationContext-reliant code before AppMain is called: things aren't initialized - // yet and stuff might break. - public static void Main(string[] args) => BuildAvaloniaApp() - .StartWithClassicDesktopLifetime(args); - - // Avalonia configuration, don't remove; also used by visual designer. - public static AppBuilder BuildAvaloniaApp() - => AppBuilder.Configure() - .UsePlatformDetect() - .LogToTrace() - .UseReactiveUI(); - } -} \ No newline at end of file diff --git a/Aurum.Micro/Services/Database.cs b/Aurum.Micro/Services/Database.cs deleted file mode 100644 index eeeedfd..0000000 --- a/Aurum.Micro/Services/Database.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections.Generic; -using Aurum.Micro.Models; - -namespace Aurum.Micro.Services -{ - public class Connections - { - public IEnumerable GetItems() => new[] - { - new ConnectionItem { ConnectionName = "US Heroku 1" }, - new ConnectionItem { ConnectionName = "US Heroku 1 CF" }, - new ConnectionItem { ConnectionName = "US Vultr 1 XTLS", IsConnected = true } - }; - } -} \ No newline at end of file diff --git a/Aurum.Micro/ViewLocator.cs b/Aurum.Micro/ViewLocator.cs deleted file mode 100644 index 08e3310..0000000 --- a/Aurum.Micro/ViewLocator.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Aurum.Micro.ViewModels; -using Avalonia.Controls; -using Avalonia.Controls.Templates; - -namespace Aurum.Micro -{ - public class ViewLocator : IDataTemplate - { - public bool SupportsRecycling => false; - - public IControl Build(object data) - { - var name = data.GetType().FullName!.Replace("ViewModel", "View"); - var type = Type.GetType(name); - - if (type != null) - { - return (Control)Activator.CreateInstance(type)!; - } - else - { - return new TextBlock { Text = "Not Found: " + name }; - } - } - - public bool Match(object data) - { - return data is ViewModelBase; - } - } -} \ No newline at end of file diff --git a/Aurum.Micro/ViewModels/AddConnectionViewModel.cs b/Aurum.Micro/ViewModels/AddConnectionViewModel.cs deleted file mode 100644 index b242f39..0000000 --- a/Aurum.Micro/ViewModels/AddConnectionViewModel.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Reactive; -using System.Reactive.Linq; -using Aurum.Micro.Models; -using ReactiveUI; - -namespace Aurum.Micro.ViewModels -{ - class AddConnectionViewModel : ViewModelBase - { - string name; - - public AddConnectionViewModel() - { - var okEnabled = this.WhenAnyValue( - x => x.Name, - x => !string.IsNullOrWhiteSpace(x) - ); - - Ok = ReactiveCommand.Create( - () => new ConnectionItem { ConnectionName = Name }, - okEnabled); - Cancel = ReactiveCommand.Create(() => { }); - } - - public string Name - { - get => name; - set => this.RaiseAndSetIfChanged(ref name, value); - } - - public ReactiveCommand Ok { get; } - public ReactiveCommand Cancel { get; } - } -} \ No newline at end of file diff --git a/Aurum.Micro/ViewModels/MainControlViewModel.cs b/Aurum.Micro/ViewModels/MainControlViewModel.cs deleted file mode 100644 index 16606f7..0000000 --- a/Aurum.Micro/ViewModels/MainControlViewModel.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using System.Collections.ObjectModel; -using Aurum.Micro.Models; - -namespace Aurum.Micro.ViewModels -{ - public class MainControlViewModel : ViewModelBase - { - public MainControlViewModel(IEnumerable items) - { - Items = new ObservableCollection(items); - } - - public ObservableCollection Items { get; } - } -} \ No newline at end of file diff --git a/Aurum.Micro/ViewModels/MainWindowViewModel.cs b/Aurum.Micro/ViewModels/MainWindowViewModel.cs deleted file mode 100644 index eb577bb..0000000 --- a/Aurum.Micro/ViewModels/MainWindowViewModel.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reactive.Linq; -using System.Text; -using System.Threading.Tasks; -using Aurum.Micro.Models; -using Aurum.Micro.Services; -using Aurum.Micro.Views; -using ReactiveUI; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Controls.ApplicationLifetimes; -using DynamicData; - -namespace Aurum.Micro.ViewModels -{ - public class MainWindowViewModel : ViewModelBase - { - public MainWindowViewModel(Connections connections) - { - List = new MainControlViewModel(connections.GetItems()); - } - - public MainControlViewModel List { get; } - - public async void AddConnection() - { - var window = new AddConnectionWindow(); - if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - var connectionName = await window.ShowDialog(desktop.MainWindow); - if (!string.IsNullOrWhiteSpace(connectionName)) - { - List.Items.Add(new ConnectionItem { ConnectionName = connectionName }); - } - } - } - } -} \ No newline at end of file diff --git a/Aurum.Micro/ViewModels/ViewModelBase.cs b/Aurum.Micro/ViewModels/ViewModelBase.cs deleted file mode 100644 index 1b406c0..0000000 --- a/Aurum.Micro/ViewModels/ViewModelBase.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ReactiveUI; - -namespace Aurum.Micro.ViewModels -{ - public class ViewModelBase : ReactiveObject - { - } -} \ No newline at end of file diff --git a/Aurum.Micro/Views/AddConnectionView.axaml b/Aurum.Micro/Views/AddConnectionView.axaml deleted file mode 100644 index db5aa3d..0000000 --- a/Aurum.Micro/Views/AddConnectionView.axaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - diff --git a/Aurum.Micro/Views/AddConnectionView.axaml.cs b/Aurum.Micro/Views/AddConnectionView.axaml.cs deleted file mode 100644 index 17af11d..0000000 --- a/Aurum.Micro/Views/AddConnectionView.axaml.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; - -namespace Aurum.Micro.Views -{ - public class AddConnectionView : UserControl - { - public AddConnectionView() - { - InitializeComponent(); - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - } -} \ No newline at end of file diff --git a/Aurum.Micro/Views/AddConnectionWindow.axaml b/Aurum.Micro/Views/AddConnectionWindow.axaml deleted file mode 100644 index 9b09daa..0000000 --- a/Aurum.Micro/Views/AddConnectionWindow.axaml +++ /dev/null @@ -1,9 +0,0 @@ - - Welcome to Avalonia! - diff --git a/Aurum.Micro/Views/AddConnectionWindow.axaml.cs b/Aurum.Micro/Views/AddConnectionWindow.axaml.cs deleted file mode 100644 index 1c36778..0000000 --- a/Aurum.Micro/Views/AddConnectionWindow.axaml.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; - -namespace Aurum.Micro.Views -{ - public class AddConnectionWindow : Window - { - public AddConnectionWindow() - { - InitializeComponent(); -#if DEBUG - this.AttachDevTools(); -#endif - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - } -} \ No newline at end of file diff --git a/Aurum.Micro/Views/MainControlView.axaml b/Aurum.Micro/Views/MainControlView.axaml deleted file mode 100644 index f4e518a..0000000 --- a/Aurum.Micro/Views/MainControlView.axaml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/Aurum.Micro/Views/MainControlView.axaml.cs b/Aurum.Micro/Views/MainControlView.axaml.cs deleted file mode 100644 index 254bbb3..0000000 --- a/Aurum.Micro/Views/MainControlView.axaml.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; - -namespace Aurum.Micro.Views -{ - public class MainControlView : UserControl - { - public MainControlView() - { - InitializeComponent(); - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - } -} \ No newline at end of file diff --git a/Aurum.Micro/Views/MainWindow.axaml b/Aurum.Micro/Views/MainWindow.axaml deleted file mode 100644 index 0d81800..0000000 --- a/Aurum.Micro/Views/MainWindow.axaml +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/Aurum.Micro/Views/MainWindow.axaml.cs b/Aurum.Micro/Views/MainWindow.axaml.cs deleted file mode 100644 index 5521590..0000000 --- a/Aurum.Micro/Views/MainWindow.axaml.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; - -namespace Aurum.Micro.Views -{ - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); -#if DEBUG - this.AttachDevTools(); -#endif - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - } -} \ No newline at end of file diff --git a/Aurum.sln b/Aurum.sln index a258f43..8ab509b 100644 --- a/Aurum.sln +++ b/Aurum.sln @@ -1,8 +1,29 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aurum.Micro", "Aurum.Micro\Aurum.Micro.csproj", "{718DE3AC-E3B3-48B9-B737-BD3116DAD8EE}" +# Visual Studio 15 +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Aurum", "Aurum\Aurum.fsproj", "{3559AFD9-7176-4BFB-8E7F-0688EABD0B53}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Aurum", "Aurum\Aurum.fsproj", "{EE9DC233-2D04-449D-9B35-108AC1945F25}" +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Aurum.DataProtection", "Aurum.DataProtection\Aurum.DataProtection.fsproj", "{4B035052-7B27-47E3-A6A5-C96D524111AA}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Aurum.Interop", "Aurum.Interop\Aurum.Interop.fsproj", "{D7F8C1C8-29E9-459A-B068-03E6FB89D721}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Aurum.Filesystem", "Aurum.Filesystem\Aurum.Filesystem.fsproj", "{9943C3ED-1A4E-4F75-8C5B-AF6E678EB264}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Aurum.Configuration", "Aurum.Configuration\Aurum.Configuration.fsproj", "{7239D687-21A3-4014-879F-4BE110216A01}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Item", "Solution Item", "{B8A29A61-BBD8-47CC-98E8-8C1DF40C79DB}" + ProjectSection(SolutionItems) = preProject + build.fsx = build.fsx + LICENSE = LICENSE + paket.dependencies = paket.dependencies + README.md = README.md + nuget.config = nuget.config + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{5756B958-4D9E-4CE4-9E02-04E9072829E0}" + ProjectSection(SolutionItems) = preProject + docs\Share-Links.md = docs\Share-Links.md + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,13 +31,28 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {718DE3AC-E3B3-48B9-B737-BD3116DAD8EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {718DE3AC-E3B3-48B9-B737-BD3116DAD8EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {718DE3AC-E3B3-48B9-B737-BD3116DAD8EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {718DE3AC-E3B3-48B9-B737-BD3116DAD8EE}.Release|Any CPU.Build.0 = Release|Any CPU - {EE9DC233-2D04-449D-9B35-108AC1945F25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE9DC233-2D04-449D-9B35-108AC1945F25}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE9DC233-2D04-449D-9B35-108AC1945F25}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE9DC233-2D04-449D-9B35-108AC1945F25}.Release|Any CPU.Build.0 = Release|Any CPU + {3559AFD9-7176-4BFB-8E7F-0688EABD0B53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3559AFD9-7176-4BFB-8E7F-0688EABD0B53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3559AFD9-7176-4BFB-8E7F-0688EABD0B53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3559AFD9-7176-4BFB-8E7F-0688EABD0B53}.Release|Any CPU.Build.0 = Release|Any CPU + {4B035052-7B27-47E3-A6A5-C96D524111AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4B035052-7B27-47E3-A6A5-C96D524111AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4B035052-7B27-47E3-A6A5-C96D524111AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4B035052-7B27-47E3-A6A5-C96D524111AA}.Release|Any CPU.Build.0 = Release|Any CPU + {D7F8C1C8-29E9-459A-B068-03E6FB89D721}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7F8C1C8-29E9-459A-B068-03E6FB89D721}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7F8C1C8-29E9-459A-B068-03E6FB89D721}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7F8C1C8-29E9-459A-B068-03E6FB89D721}.Release|Any CPU.Build.0 = Release|Any CPU + {9943C3ED-1A4E-4F75-8C5B-AF6E678EB264}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9943C3ED-1A4E-4F75-8C5B-AF6E678EB264}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9943C3ED-1A4E-4F75-8C5B-AF6E678EB264}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9943C3ED-1A4E-4F75-8C5B-AF6E678EB264}.Release|Any CPU.Build.0 = Release|Any CPU + {7239D687-21A3-4014-879F-4BE110216A01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7239D687-21A3-4014-879F-4BE110216A01}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7239D687-21A3-4014-879F-4BE110216A01}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7239D687-21A3-4014-879F-4BE110216A01}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {5756B958-4D9E-4CE4-9E02-04E9072829E0} = {B8A29A61-BBD8-47CC-98E8-8C1DF40C79DB} EndGlobalSection EndGlobal diff --git a/Aurum.sln.DotSettings b/Aurum.sln.DotSettings index db392d8..845e9b5 100644 --- a/Aurum.sln.DotSettings +++ b/Aurum.sln.DotSettings @@ -1,5 +1,19 @@  + True + True + True + + True + True True True + True True - True \ No newline at end of file + True + ShowAndRun + INFO + On + On + On + True + True diff --git a/Aurum.sln.DotSettings.user b/Aurum.sln.DotSettings.user deleted file mode 100644 index 2f77621..0000000 --- a/Aurum.sln.DotSettings.user +++ /dev/null @@ -1,6 +0,0 @@ - - INFO - On - On - On - True \ No newline at end of file diff --git a/Aurum/Aurum.fsproj b/Aurum/Aurum.fsproj index 8a2aa34..6bed424 100644 --- a/Aurum/Aurum.fsproj +++ b/Aurum/Aurum.fsproj @@ -1,19 +1,21 @@ - - + + - net5.0 + net7.0 true + Aurum + 0.1.0-beta.1 + Shanoa Ice + Helper library for the Aurum project. + git + https://github.com/Shadowsocks-NET/Aurum - - - - + + + + + - - - - - - + diff --git a/Aurum/Exceptions.fs b/Aurum/Exceptions.fs new file mode 100644 index 0000000..cb27593 --- /dev/null +++ b/Aurum/Exceptions.fs @@ -0,0 +1,6 @@ +[] +module Aurum.Exceptions + +exception ShareLinkFormatException of string +exception ConfigurationParameterException of string +exception RuleTypeNotMatchException diff --git a/Aurum/Helpers.fs b/Aurum/Helpers.fs new file mode 100644 index 0000000..c469100 --- /dev/null +++ b/Aurum/Helpers.fs @@ -0,0 +1,115 @@ +namespace Aurum + +open System +open System.Runtime.InteropServices +open System.IO +open System.Collections.Generic +open Microsoft.Extensions.Primitives +open System.Text.Json +open System.Text.Json.Serialization +open FSharpPlus + +[] +module Helpers = + type identity<'a> = 'a -> 'a + + let retrieveKeyFromDict (dict: Dictionary<'K, 'V>) key = + try + Ok(dict.[key]) + with :? KeyNotFoundException as e -> + Error(e :> exn) + + let tryRetrieveKeyFromDict (dict: Dictionary<'K, 'V>) key = + try + Some(dict.[key]) + with :? KeyNotFoundException -> + None + + let unwrapResult result = + match result with + | Ok some -> some + | Error error -> raise error + + let getFirstQuerystringEntry (dict: Dictionary) (key: string) = + retrieveKeyFromDict dict key |> Result.map (fun x -> x.[0]) + + let tryGetFirstQuerystringEntry (dict: Dictionary) (key: string) : string option = + match tryRetrieveKeyFromDict dict key with + | Some value -> Some(value.[0]) + | None -> None + + let blankStringToNone (string: string option) = + Option.filter (fun x -> x.Equals("")) string + + let emptyListToNone list = + if List.isEmpty list then None else Some list + + let tryRetrieveFromShareLink queryParams key = + tryGetFirstQuerystringEntry queryParams key |> blankStringToNone + + let mergeOptionList op1 op2 = + match op1, op2 with + | Some x, Some y -> Some(x @ y) + | op1, op2 -> Option.orElse op1 op2 + + let singSystemTextJsonOptions = + JsonSerializerOptions( + PropertyNamingPolicy = JsonNamingPolicy.SnakeCase, + WriteIndented = true, + NumberHandling = JsonNumberHandling.AllowReadingFromString + ) + + JsonFSharpOptions() + .WithUnionInternalTag() + .WithUnionAllowUnorderedTag() + .WithUnwrapOption() + .WithUnionUnwrapRecordCases() + .WithUnionTagName("type") + .WithUnionTagNamingPolicy(JsonNamingPolicy.SnakeCase) + .WithUnionFieldNamingPolicy(JsonNamingPolicy.SnakeCase) + .WithSkippableOptionFields() + .WithAllowOverride() + .AddToJsonSerializerOptions(singSystemTextJsonOptions) + + let v2flySystemTextJsonOptions = + JsonSerializerOptions( + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + WriteIndented = true, + NumberHandling = JsonNumberHandling.AllowReadingFromString + ) + + JsonFSharpOptions + .ThothLike() + .WithUnwrapOption() + .WithUnionUnwrapRecordCases() + .WithUnionTagName("type") + .WithUnionTagNamingPolicy(JsonNamingPolicy.CamelCase) + .WithUnionFieldNamingPolicy(JsonNamingPolicy.CamelCase) + .WithSkippableOptionFields() + .AddToJsonSerializerOptions(v2flySystemTextJsonOptions) + + let encodeBase64 (text: string) = + let plainBytes = System.Text.Encoding.UTF8.GetBytes text + System.Convert.ToBase64String plainBytes + + let decodeBase64 string = + let rawBytes = System.Convert.FromBase64String string + System.Text.Encoding.UTF8.GetString rawBytes + + let decodeBase64Url string = + let rawBytes = Microsoft.AspNetCore.WebUtilities.WebEncoders.Base64UrlDecode string + System.Text.Encoding.UTF8.GetString rawBytes + + let getDataDirectory appName = + let baseDirectory = + if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + elif RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "/Library/Application Support") + else + Option.ofObj (Environment.GetEnvironmentVariable("XDG_DATA_HOME")) + |> Option.defaultValue ( + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local/share") + ) + + Path.Combine(baseDirectory, appName) diff --git a/Aurum/Library.fs b/Aurum/Library.fs deleted file mode 100644 index 0826687..0000000 --- a/Aurum/Library.fs +++ /dev/null @@ -1,4 +0,0 @@ -namespace Aurum - -module Say = - let hello name = printfn "Hello %s" name diff --git a/Aurum/SnakeCase.fs b/Aurum/SnakeCase.fs new file mode 100644 index 0000000..f7bd448 --- /dev/null +++ b/Aurum/SnakeCase.fs @@ -0,0 +1,14 @@ +module System.Text.Json.JsonNamingPolicy + +open System.Text.Json +open Messerli.ChangeCase + +type SnakeCaseNamingPolicy() = + inherit JsonNamingPolicy() + + override this.ConvertName(name) = name.ToSnakeCase() + +/// Added by Sing Configuration Generator. +/// +/// This naming policy converts all names to lower-cased snake case, such as PascalCase -> pascal_case +let SnakeCase = SnakeCaseNamingPolicy() diff --git a/Aurum/internal-config.json b/Aurum/internal-config.json deleted file mode 100644 index e5ce929..0000000 --- a/Aurum/internal-config.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "Vultr Los Angeles", - "tags": [], - "host": "los-angeles.vultr-node.xyz", - "port": 6514, - "protocol": { - "type": "vless", - "settings": { - "credentials": { - "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - "encryption": "none" - }, - "transport": { - "protocol": "ws", - "settings": { - "path": "/wss", - "maxEarlyData": 0, - "browserForwarding": false, - "earlyDataHeader": "", - "headers": { - "Host": "" - } - } - }, - "security": { - "type": "tls", - "settings": { - "sessionResumption": false, - "useSystemRootCert": true, - "sni": "", - "alpn": "" - } - }, - "mux": { - "enabled": false, - "concurrency": 8 - } - } - } -} diff --git a/Aurum/paket.references b/Aurum/paket.references new file mode 100644 index 0000000..0636d93 --- /dev/null +++ b/Aurum/paket.references @@ -0,0 +1,7 @@ +Microsoft.Extensions.Primitives +Microsoft.AspNetCore.WebUtilities +FSharp.Json +FSharp.SystemTextJson +Messerli.ChangeCase +Aether +FSharpPlus diff --git a/Aurum/paket.template b/Aurum/paket.template new file mode 100644 index 0000000..ca02e7a --- /dev/null +++ b/Aurum/paket.template @@ -0,0 +1,8 @@ +type project +id Aurum +version 0.1.0-beta.1 +authors Shanoa Ice +description + Helper library for the Aurum project. +licenseExpression LGPL-3.0-only +repositoryUrl https://github.com/Shadowsocks-NET/Aurum diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7b6bec5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,841 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/README.md b/README.md index a1889e7..6da04ce 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,27 @@ # Aurum -Aurum is a cross-platform GUI for the v2ray family of anti-censorship applications. -`Aurum.Micro` is the experimental, minimal GUI of this project, written in C# and Avalonia.Ui +[![build](https://github.com/Shadowsocks-NET/Aurum/actions/workflows/build.yml/badge.svg)](https://github.com/Shadowsocks-NET/Aurum/actions/workflows/build.yml) [![Publish Github Packages](https://github.com/Shadowsocks-NET/Aurum/actions/workflows/publish-github.yml/badge.svg)](https://github.com/Shadowsocks-NET/Aurum/actions/workflows/publish-github.yml) [![Publish MyGet Packages](https://github.com/Shadowsocks-NET/Aurum/actions/workflows/publish-myget.yml/badge.svg)](https://github.com/Shadowsocks-NET/Aurum/actions/workflows/publish-myget.yml) -`Aurum` is the backend library for command operations such as configuration generation and evaluation, v2ray instance management and perhaps tun2socks support. +Aurum is a cross-platform GUI for anti-censorship applications such as sing-box, v2ray, etc. -_(planned)_ `Aurum.C_API` is a C-style API interface for the `Aurum` core library, which will allow languages that support calling a C-style API (FFI) to utilize the functionality provided by the `Aurum` core library. +`Aurum.*` is the backend library for command operations such as configuration generation and evaluation, proxy instance +management. -For more information of each subprojects, reference to their individual README files. +The graphical frontend is not available as of now, but it will be based on Avalonia. + +The backend is under active development and is not tested at all, please be careful. + +## Usage + +Aurum is still in active development. To use the development version of this library, please use +this [MyGet Feed](https://www.myget.org/feed/Packages/aurum). ## Stargazers over time [![Stargazers over time](https://starchart.cc/Shadowsocks-NET/Aurum.svg)](https://starchart.cc/Shadowsocks-NET/Aurum) +## License + +The Aurum project is licensed under [LGPL-3.0-only](LICENSE). + +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FShadowsocks-NET%2FAurum.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FShadowsocks-NET%2FAurum?ref=badge_large) diff --git a/build.fsx b/build.fsx new file mode 100644 index 0000000..9768cb6 --- /dev/null +++ b/build.fsx @@ -0,0 +1,3 @@ +#r "paket: +nuget Fake.Core.Target //" +#load "./.fake/build.fsx/intellisense.fsx" diff --git a/build.fsx.lock b/build.fsx.lock new file mode 100644 index 0000000..5e5a8b9 --- /dev/null +++ b/build.fsx.lock @@ -0,0 +1,68 @@ +STORAGE: NONE +RESTRICTION: == netstandard2.0 +NUGET + remote: https://api.nuget.org/v3/index.json + Fake.Core.CommandLineParsing (5.20.4) + FParsec (>= 1.1.1) + FSharp.Core (>= 4.7.2) + Fake.Core.Context (5.20.4) + FSharp.Core (>= 4.7.2) + Fake.Core.Environment (5.20.4) + FSharp.Core (>= 4.7.2) + Fake.Core.FakeVar (5.20.4) + Fake.Core.Context (>= 5.20.4) + FSharp.Core (>= 4.7.2) + Fake.Core.Process (5.20.4) + Fake.Core.Environment (>= 5.20.4) + Fake.Core.FakeVar (>= 5.20.4) + Fake.Core.String (>= 5.20.4) + Fake.Core.Trace (>= 5.20.4) + Fake.IO.FileSystem (>= 5.20.4) + FSharp.Core (>= 4.7.2) + System.Collections.Immutable (>= 1.7.1) + Fake.Core.String (5.20.4) + FSharp.Core (>= 4.7.2) + Fake.Core.Target (5.20.4) + Fake.Core.CommandLineParsing (>= 5.20.4) + Fake.Core.Context (>= 5.20.4) + Fake.Core.Environment (>= 5.20.4) + Fake.Core.FakeVar (>= 5.20.4) + Fake.Core.Process (>= 5.20.4) + Fake.Core.String (>= 5.20.4) + Fake.Core.Trace (>= 5.20.4) + FSharp.Control.Reactive (>= 4.4.2) + FSharp.Core (>= 4.7.2) + Fake.Core.Trace (5.20.4) + Fake.Core.Environment (>= 5.20.4) + Fake.Core.FakeVar (>= 5.20.4) + FSharp.Core (>= 4.7.2) + Fake.IO.FileSystem (5.20.4) + Fake.Core.String (>= 5.20.4) + FSharp.Core (>= 4.7.2) + FParsec (1.1.1) + FSharp.Core (>= 4.3.4) + FSharp.Control.Reactive (5.0.2) + FSharp.Core (>= 4.7.2) + System.Reactive (>= 5.0) + FSharp.Core (6.0) + Microsoft.NETCore.Platforms (5.0.4) + Microsoft.NETCore.Targets (5.0) + System.Buffers (4.5.1) + System.Collections.Immutable (5.0) + System.Memory (>= 4.5.4) + System.Memory (4.5.4) + System.Buffers (>= 4.5.1) + System.Numerics.Vectors (>= 4.4) + System.Runtime.CompilerServices.Unsafe (>= 4.5.3) + System.Numerics.Vectors (4.5) + System.Reactive (5.0) + System.Runtime.InteropServices.WindowsRuntime (>= 4.3) + System.Threading.Tasks.Extensions (>= 4.5.4) + System.Runtime (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) + System.Runtime.CompilerServices.Unsafe (5.0) + System.Runtime.InteropServices.WindowsRuntime (4.3) + System.Runtime (>= 4.3) + System.Threading.Tasks.Extensions (4.5.4) + System.Runtime.CompilerServices.Unsafe (>= 4.5.3) diff --git a/docfx_project/.gitignore b/docfx_project/.gitignore new file mode 100644 index 0000000..2781f6d --- /dev/null +++ b/docfx_project/.gitignore @@ -0,0 +1,9 @@ +############### +# folder # +############### +/**/DROP/ +/**/TEMP/ +/**/packages/ +/**/bin/ +/**/obj/ +_site diff --git a/docfx_project/api/.gitignore b/docfx_project/api/.gitignore new file mode 100644 index 0000000..f798527 --- /dev/null +++ b/docfx_project/api/.gitignore @@ -0,0 +1,5 @@ +############### +# temp file # +############### +*.yml +.manifest diff --git a/docfx_project/api/index.md b/docfx_project/api/index.md new file mode 100644 index 0000000..1cb6831 --- /dev/null +++ b/docfx_project/api/index.md @@ -0,0 +1,2 @@ +# PLACEHOLDER +TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*! diff --git a/docfx_project/articles/intro.md b/docfx_project/articles/intro.md new file mode 100644 index 0000000..901a16a --- /dev/null +++ b/docfx_project/articles/intro.md @@ -0,0 +1 @@ +# Add your introductions here! diff --git a/docfx_project/articles/toc.yml b/docfx_project/articles/toc.yml new file mode 100644 index 0000000..f64352c --- /dev/null +++ b/docfx_project/articles/toc.yml @@ -0,0 +1,2 @@ +- name: Introduction + href: intro.md diff --git a/docfx_project/docfx.json b/docfx_project/docfx.json new file mode 100644 index 0000000..d38acca --- /dev/null +++ b/docfx_project/docfx.json @@ -0,0 +1,58 @@ +{ + "metadata": [ + { + "src": [ + { + "files": [ + "Aurum*/bin/**/*.dll" + ], + "src": "../" + } + ], + "dest": "api", + "includePrivateMembers": false, + "disableGitFeatures": false, + "disableDefaultFilter": false, + "noRestore": false, + "namespaceLayout": "flattened", + "memberLayout": "samePage", + "EnumSortOrder": "alphabetic", + "allowCompilationErrors": false + } + ], + "build": { + "content": [ + { + "files": [ + "api/**.yml", + "api/index.md" + ] + }, + { + "files": [ + "articles/**.md", + "articles/**/toc.yml", + "toc.yml", + "*.md" + ] + } + ], + "resource": [ + { + "files": [ + "images/**" + ] + } + ], + "output": "_site", + "globalMetadataFiles": [], + "fileMetadataFiles": [], + "template": [ + "default", + "modern" + ], + "postProcessors": [], + "keepFileLink": false, + "disableGitFeatures": false + } +} diff --git a/docfx_project/index.md b/docfx_project/index.md new file mode 100644 index 0000000..95887de --- /dev/null +++ b/docfx_project/index.md @@ -0,0 +1,4 @@ +# This is the **HOMEPAGE**. +Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files. +## Quick Start Notes: +1. Add images to the *images* folder if the file is referencing an image. diff --git a/docfx_project/toc.yml b/docfx_project/toc.yml new file mode 100644 index 0000000..c06f5ab --- /dev/null +++ b/docfx_project/toc.yml @@ -0,0 +1,5 @@ +- name: Articles + href: articles/ +- name: Api Documentation + href: api/ + homepage: api/index.md diff --git a/docs/Share-Links.md b/docs/Share-Links.md new file mode 100644 index 0000000..cac2c3f --- /dev/null +++ b/docs/Share-Links.md @@ -0,0 +1,29 @@ +# Import Share Links + +Aurum supports importing VMessAEAD/VLESS (deprecated), Shadowsocks SIP002 ( +via [Shadowsocks.NET](https://github.com/Shadowsocks-NET/Shadowsocks.NET)) and legacy v2rayN base64 share links. This describes behaviors when importing share links. + +## VMessAEAD/VLESS + +In the original v2ray-core, VLESS is considered obsolete, thus Aurum will not include its support in any version prior to `v1` release. + +VMessAEAD will be the major supported protocol, but there is some subtle difference compared to the VMessAEAD share links standard proposal: + +- Blank strings for all non-mandatory fields are silently ignored and won't throw error, instead falling back to the default entry value. +- gRPC's `mode` field is always silently ignored, since none of `v2ray@5` and `sing-box` supports alternative gRPC modes specified in the share link spec (those modes are proposed mainly by the Xray branch). +- XTLS related field is ignored (as VMess does not support XTLS, and VLESS which supports that is obsolete). + +Xray support is undetermined, as XTLS and its successor Reality is a largely incompatible feature which requires VLESS, a protocol that is considered obsolete for most other implementations. Also, its developer and community had shown public hostility for some members of the original v2fly community. + +## Legacy v2rayN base64 format + +The legacy v2rayN base64 share link format support generally follows the [v2rayN spec (in Chinese)](https://github.com/2dust/v2rayN/wiki/%E5%88%86%E4%BA%AB%E9%93%BE%E6%8E%A5%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E(ver-2)), with the following exceptions: + +- None of `v2ray@5` and `sing-box` supports disguise type (other than `http` which is the only available one in TCP) with KCP and QUIC, thus the `type` field will always be ignored. This might cause you to not be able to connect to some proxy providers that still uses this feature, please be careful. +- Although disguise type other than `http` is always ignored, `host` will still be respected when the transport is TCP or HTTP (HTTP/2). None of `v2ray@5` and `sing-box` supports custom headers on QUIC and KCP, thus `host` will be ignored on these transports. + +## Shadowsocks SIP002 URI Scheme + +Shadowsocks SIP002 URI Scheme is fully implemented with the exception of obsolete Stream Ciphers. + +Only simple-obfs and v2ray plugins are supported. Simple-obfs is deprecated, though, thus you should consider migrating to v2ray. diff --git a/Aurum.Micro/Assets/Golden_Crystal.png b/docs/img/logo.png similarity index 100% rename from Aurum.Micro/Assets/Golden_Crystal.png rename to docs/img/logo.png diff --git a/global.json b/global.json index ee8d0ad..eafb435 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,6 @@ { "sdk": { - "version": "5.0", - "rollForward": "latestFeature", - "allowPrerelease": true + "rollForward": "latestMajor", + "allowPrerelease": false } } \ No newline at end of file diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..a46a2c2 --- /dev/null +++ b/nuget.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/nuget/.gitkeep b/nuget/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/paket.dependencies b/paket.dependencies new file mode 100644 index 0000000..9fcd870 --- /dev/null +++ b/paket.dependencies @@ -0,0 +1,21 @@ +source https://api.nuget.org/v3/index.json +cache ./paket-cache versions: current + +framework: net7.0 + +nuget Akka.FSharp +nuget Akka.Hosting +nuget sqlite-net-pcl +nuget Serilog.Sinks.Console +nuget Serilog.Sinks.File +nuget Microsoft.AspNetCore.WebUtilities +nuget Nanoid +nuget FSharp.Json +nuget FSharp.SystemTextJson +nuget FSharp.Core +nuget Aether +nuget System.Security.Cryptography.ProtectedData +nuget ProtoBuf.FSharp +nuget FSharp.Control.Reactive +nuget FSharpPlus +nuget Messerli.ChangeCase diff --git a/paket.lock b/paket.lock new file mode 100644 index 0000000..1bd0821 --- /dev/null +++ b/paket.lock @@ -0,0 +1,211 @@ +RESTRICTION: == net7.0 +NUGET + remote: https://api.nuget.org/v3/index.json + Aether (8.3.1) + FSharp.Core (>= 4.3.4) + Akka (1.5.13) + Microsoft.Extensions.ObjectPool (>= 7.0.10) + Newtonsoft.Json (>= 13.0.1) + System.Collections.Immutable (>= 5.0) + System.Configuration.ConfigurationManager (>= 6.0.1) + System.Reflection.Emit (>= 4.7) + System.Threading.Channels (>= 5.0) + Akka.DependencyInjection (1.5.13) + Akka (>= 1.5.13) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1) + Akka.FSharp (1.5.13) + Akka (>= 1.5.13) + FSharp.Core (>= 7.0) + FSharp.Quotations.Evaluator (>= 2.1) + FsPickler (>= 5.3.2) + Akka.Hosting (1.5.12.1) + Akka.DependencyInjection (>= 1.5.12) + Microsoft.Extensions.Configuration (>= 3.0) + Microsoft.Extensions.Hosting (>= 3.0) + FSharp.Control.Reactive (5.0.5) + FSharp.Core (>= 4.7.2) + System.Reactive (>= 5.0 < 6.0) + FSharp.Core (7.0.400) + FSharp.Json (0.4.1) + FSharp.Core (>= 4.6.2) + FSharp.Quotations.Evaluator (2.1) + FSharp.Core (>= 4.3.1) + FSharp.SystemTextJson (1.2.42) + FSharp.Core (>= 4.7) + System.Text.Json (>= 6.0) + FSharpPlus (1.4.1) + FSharp.Core (>= 6.0.6) + FsPickler (5.3.2) + FSharp.Core (>= 4.3.2) + System.Reflection.Emit.Lightweight (>= 4.3) + Funcky (3.3) + Google.Protobuf (3.24.3) + Messerli.ChangeCase (1.2.1) + Funcky (>= 3.0 < 4.0) + Microsoft.AspNetCore.WebUtilities (2.2) + Microsoft.Net.Http.Headers (>= 2.2) + System.Text.Encodings.Web (>= 4.5) + Microsoft.Extensions.Configuration (7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Primitives (>= 7.0) + Microsoft.Extensions.Configuration.Abstractions (7.0) + Microsoft.Extensions.Primitives (>= 7.0) + Microsoft.Extensions.Configuration.Binder (7.0.4) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Configuration.CommandLine (7.0) + Microsoft.Extensions.Configuration (>= 7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Configuration.EnvironmentVariables (7.0) + Microsoft.Extensions.Configuration (>= 7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Configuration.FileExtensions (7.0) + Microsoft.Extensions.Configuration (>= 7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.FileProviders.Abstractions (>= 7.0) + Microsoft.Extensions.FileProviders.Physical (>= 7.0) + Microsoft.Extensions.Primitives (>= 7.0) + Microsoft.Extensions.Configuration.Json (7.0) + Microsoft.Extensions.Configuration (>= 7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Configuration.FileExtensions (>= 7.0) + Microsoft.Extensions.FileProviders.Abstractions (>= 7.0) + System.Text.Json (>= 7.0) + Microsoft.Extensions.Configuration.UserSecrets (7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Configuration.Json (>= 7.0) + Microsoft.Extensions.FileProviders.Abstractions (>= 7.0) + Microsoft.Extensions.FileProviders.Physical (>= 7.0) + Microsoft.Extensions.DependencyInjection (7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (7.0) + Microsoft.Extensions.FileProviders.Abstractions (7.0) + Microsoft.Extensions.Primitives (>= 7.0) + Microsoft.Extensions.FileProviders.Physical (7.0) + Microsoft.Extensions.FileProviders.Abstractions (>= 7.0) + Microsoft.Extensions.FileSystemGlobbing (>= 7.0) + Microsoft.Extensions.Primitives (>= 7.0) + Microsoft.Extensions.FileSystemGlobbing (7.0) + Microsoft.Extensions.Hosting (7.0.1) + Microsoft.Extensions.Configuration (>= 7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Configuration.Binder (>= 7.0.3) + Microsoft.Extensions.Configuration.CommandLine (>= 7.0) + Microsoft.Extensions.Configuration.EnvironmentVariables (>= 7.0) + Microsoft.Extensions.Configuration.FileExtensions (>= 7.0) + Microsoft.Extensions.Configuration.Json (>= 7.0) + Microsoft.Extensions.Configuration.UserSecrets (>= 7.0) + Microsoft.Extensions.DependencyInjection (>= 7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.FileProviders.Abstractions (>= 7.0) + Microsoft.Extensions.FileProviders.Physical (>= 7.0) + Microsoft.Extensions.Hosting.Abstractions (>= 7.0) + Microsoft.Extensions.Logging (>= 7.0) + Microsoft.Extensions.Logging.Abstractions (>= 7.0) + Microsoft.Extensions.Logging.Configuration (>= 7.0) + Microsoft.Extensions.Logging.Console (>= 7.0) + Microsoft.Extensions.Logging.Debug (>= 7.0) + Microsoft.Extensions.Logging.EventLog (>= 7.0) + Microsoft.Extensions.Logging.EventSource (>= 7.0) + Microsoft.Extensions.Options (>= 7.0.1) + System.Diagnostics.DiagnosticSource (>= 7.0.1) + Microsoft.Extensions.Hosting.Abstractions (7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.FileProviders.Abstractions (>= 7.0) + Microsoft.Extensions.Logging (7.0) + Microsoft.Extensions.DependencyInjection (>= 7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.Logging.Abstractions (>= 7.0) + Microsoft.Extensions.Options (>= 7.0) + Microsoft.Extensions.Logging.Abstractions (7.0.1) + Microsoft.Extensions.Logging.Configuration (7.0) + Microsoft.Extensions.Configuration (>= 7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Configuration.Binder (>= 7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.Logging (>= 7.0) + Microsoft.Extensions.Logging.Abstractions (>= 7.0) + Microsoft.Extensions.Options (>= 7.0) + Microsoft.Extensions.Options.ConfigurationExtensions (>= 7.0) + Microsoft.Extensions.Logging.Console (7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.Logging (>= 7.0) + Microsoft.Extensions.Logging.Abstractions (>= 7.0) + Microsoft.Extensions.Logging.Configuration (>= 7.0) + Microsoft.Extensions.Options (>= 7.0) + System.Text.Json (>= 7.0) + Microsoft.Extensions.Logging.Debug (7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.Logging (>= 7.0) + Microsoft.Extensions.Logging.Abstractions (>= 7.0) + Microsoft.Extensions.Logging.EventLog (7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.Logging (>= 7.0) + Microsoft.Extensions.Logging.Abstractions (>= 7.0) + Microsoft.Extensions.Options (>= 7.0) + System.Diagnostics.EventLog (>= 7.0) + Microsoft.Extensions.Logging.EventSource (7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.Logging (>= 7.0) + Microsoft.Extensions.Logging.Abstractions (>= 7.0) + Microsoft.Extensions.Options (>= 7.0) + Microsoft.Extensions.Primitives (>= 7.0) + System.Text.Json (>= 7.0) + Microsoft.Extensions.ObjectPool (7.0.11) + Microsoft.Extensions.Options (7.0.1) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.Primitives (>= 7.0) + Microsoft.Extensions.Options.ConfigurationExtensions (7.0) + Microsoft.Extensions.Configuration.Abstractions (>= 7.0) + Microsoft.Extensions.Configuration.Binder (>= 7.0) + Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0) + Microsoft.Extensions.Options (>= 7.0) + Microsoft.Extensions.Primitives (>= 7.0) + Microsoft.Extensions.Primitives (7.0) + Microsoft.Net.Http.Headers (2.2.8) + Microsoft.Extensions.Primitives (>= 2.2) + System.Buffers (>= 4.5) + Microsoft.Win32.SystemEvents (7.0) + Nanoid (3.0) + Newtonsoft.Json (13.0.3) + Protobuf.FSharp (0.2) + FSharp.Core (>= 6.0.2) + Google.Protobuf (>= 3.17.3) + Serilog (3.0.1) + Serilog.Sinks.Console (4.1) + Serilog (>= 2.10) + Serilog.Sinks.File (5.0) + Serilog (>= 2.10) + sqlite-net-pcl (1.8.116) + SQLitePCLRaw.bundle_green (>= 2.0.4) + SQLitePCLRaw.bundle_green (2.1.6) + SQLitePCLRaw.lib.e_sqlite3 (>= 2.1.6) + SQLitePCLRaw.provider.e_sqlite3 (>= 2.1.6) + SQLitePCLRaw.core (2.1.6) + System.Memory (>= 4.5.3) + SQLitePCLRaw.lib.e_sqlite3 (2.1.6) + SQLitePCLRaw.provider.e_sqlite3 (2.1.6) + SQLitePCLRaw.core (>= 2.1.6) + System.Buffers (4.5.1) + System.Collections.Immutable (7.0) + System.Configuration.ConfigurationManager (7.0) + System.Diagnostics.EventLog (>= 7.0) + System.Security.Cryptography.ProtectedData (>= 7.0) + System.Security.Permissions (>= 7.0) + System.Diagnostics.DiagnosticSource (7.0.2) + System.Diagnostics.EventLog (7.0) + System.Drawing.Common (7.0) + Microsoft.Win32.SystemEvents (>= 7.0) + System.Memory (4.5.5) + System.Reactive (5.0) + System.Reflection.Emit (4.7) + System.Reflection.Emit.Lightweight (4.7) + System.Security.Cryptography.ProtectedData (7.0.1) + System.Security.Permissions (7.0) + System.Windows.Extensions (>= 7.0) + System.Text.Encodings.Web (7.0) + System.Text.Json (7.0.3) + System.Text.Encodings.Web (>= 7.0) + System.Threading.Channels (7.0) + System.Windows.Extensions (7.0) + System.Drawing.Common (>= 7.0) diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..f9c2c32 --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base" + ] +}