-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffe515d
commit c1e8d86
Showing
10 changed files
with
123 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
#### 要求 | ||
|
||
* iOS 15.0+ | ||
* macOS 12.0+ with Apple Silicon | ||
* 一个非中国大陆地区的 Apple 账号 | ||
|
||
#### 下载 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Specification | ||
|
||
## Profile | ||
|
||
Profile defines a single-box configuration with metadata in a GUI client. | ||
|
||
## Profile Types | ||
|
||
### Local | ||
|
||
Create a empty configuration or import from a local file. | ||
|
||
### iCloud (on Apple platforms) | ||
|
||
Create a new configuration or use an existing configuration on iCloud. | ||
|
||
### Remote | ||
|
||
Use a remote URL as the configuration source, with HTTP basic authentication and automatic update support. | ||
|
||
#### URL specification | ||
|
||
``` | ||
sing-box://import-remote-profile?url=urlEncodedURL#urlEncodedName | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Android | ||
|
||
## Termux | ||
|
||
```shell | ||
pkg add sing-box | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# macOS | ||
|
||
## Homebrew (core) | ||
|
||
```shell | ||
brew install sing-box | ||
``` | ||
|
||
## Homebrew (Tap) | ||
|
||
```shell | ||
brew tap sagernet/sing-box | ||
brew install sagernet/sing-box/sing-box | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Windows | ||
|
||
## Chocolatey | ||
|
||
```shell | ||
choco install sing-box | ||
``` | ||
|
||
## winget | ||
|
||
```shell | ||
winget install sing-box | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package libbox | ||
|
||
import ( | ||
"net/url" | ||
) | ||
|
||
func GenerateRemoteProfileImportLink(name string, remoteURL string) string { | ||
importLink := &url.URL{ | ||
Scheme: "sing-box", | ||
Host: "import-remote-profile", | ||
RawQuery: url.Values{"url": []string{remoteURL}}.Encode(), | ||
Fragment: name, | ||
} | ||
return importLink.String() | ||
} | ||
|
||
type ImportRemoteProfile struct { | ||
Name string | ||
URL string | ||
Host string | ||
} | ||
|
||
func ParseRemoteProfileImportLink(importLink string) (*ImportRemoteProfile, error) { | ||
importURL, err := url.Parse(importLink) | ||
if err != nil { | ||
return nil, err | ||
} | ||
remoteURL, err := url.Parse(importURL.Query().Get("url")) | ||
if err != nil { | ||
return nil, err | ||
} | ||
name := importURL.Fragment | ||
if name == "" { | ||
name = remoteURL.Host | ||
} | ||
return &ImportRemoteProfile{ | ||
Name: name, | ||
URL: remoteURL.String(), | ||
Host: remoteURL.Host, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters