mirror of https://github.com/cbeuw/Cloak
Human friendly key and uid generators
This commit is contained in:
parent
a803d20970
commit
21bcb53062
|
|
@ -165,9 +165,8 @@ is established.
|
||||||
|
|
||||||
0. Install at least one underlying proxy server (e.g. OpenVPN, Shadowsocks).
|
0. Install at least one underlying proxy server (e.g. OpenVPN, Shadowsocks).
|
||||||
1. Download [the latest release](https://github.com/cbeuw/Cloak/releases) or clone and build this repo.
|
1. Download [the latest release](https://github.com/cbeuw/Cloak/releases) or clone and build this repo.
|
||||||
2. Run `ck-server -k`. The base64 string before the comma is the **public** key to be given to users, the one after the
|
2. Run `ck-server -key`. The **public** should be given to users, the **private** key should be kept secret.
|
||||||
comma is the **private** key to be kept secret.
|
3. Run `ck-server -uid`. The new UID will be used as `AdminUID`.
|
||||||
3. Run `ck-server -u`. This will be used as the `AdminUID`.
|
|
||||||
4. Copy example_config/ckserver.json into a desired location. Change `PrivateKey` to the private key you just obtained;
|
4. Copy example_config/ckserver.json into a desired location. Change `PrivateKey` to the private key you just obtained;
|
||||||
change `AdminUID` to the UID you just obtained.
|
change `AdminUID` to the UID you just obtained.
|
||||||
5. Configure your underlying proxy server so that they all listen on localhost. Edit `ProxyBook` in the configuration
|
5. Configure your underlying proxy server so that they all listen on localhost. Edit `ProxyBook` in the configuration
|
||||||
|
|
@ -181,7 +180,7 @@ is established.
|
||||||
|
|
||||||
##### Unrestricted users
|
##### Unrestricted users
|
||||||
|
|
||||||
Run `ck-server -u` and add the UID into the `BypassUID` field in `ckserver.json`
|
Run `ck-server -uid` and add the UID into the `BypassUID` field in `ckserver.json`
|
||||||
|
|
||||||
##### Users subject to bandwidth and credit controls
|
##### Users subject to bandwidth and credit controls
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,11 @@ func main() {
|
||||||
askVersion := flag.Bool("v", false, "Print the version number")
|
askVersion := flag.Bool("v", false, "Print the version number")
|
||||||
printUsage := flag.Bool("h", false, "Print this message")
|
printUsage := flag.Bool("h", false, "Print this message")
|
||||||
|
|
||||||
genUID := flag.Bool("u", false, "Generate a UID")
|
genUIDScript := flag.Bool("u", false, "Generate a UID to STDOUT")
|
||||||
genKeyPair := flag.Bool("k", false, "Generate a pair of public and private key, output in the format of pubkey,pvkey")
|
genKeyPairScript := flag.Bool("k", false, "Generate a pair of public and private key and output to STDOUT in the format of <public key>,<private key>")
|
||||||
|
|
||||||
|
genUIDHuman := flag.Bool("uid", false, "Generate and print out a UID")
|
||||||
|
genKeyPairHuman := flag.Bool("key", false, "Generate and print out a public-private key pair")
|
||||||
|
|
||||||
pprofAddr := flag.String("d", "", "debug use: ip:port to be listened by pprof profiler")
|
pprofAddr := flag.String("d", "", "debug use: ip:port to be listened by pprof profiler")
|
||||||
verbosity := flag.String("verbosity", "info", "verbosity level")
|
verbosity := flag.String("verbosity", "info", "verbosity level")
|
||||||
|
|
@ -96,13 +99,23 @@ func main() {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if *genUID {
|
if *genUIDScript || *genUIDHuman {
|
||||||
fmt.Println(generateUID())
|
uid := generateUID()
|
||||||
|
if *genUIDScript {
|
||||||
|
fmt.Println(uid)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("\x1B[35mYour UID is:\u001B[0m %s\n", uid)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if *genKeyPair {
|
if *genKeyPairScript || *genKeyPairHuman {
|
||||||
pub, pv := generateKeyPair()
|
pub, pv := generateKeyPair()
|
||||||
fmt.Printf("%v,%v", pub, pv)
|
if *genKeyPairScript {
|
||||||
|
fmt.Printf("%v,%v\n", pub, pv)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("\x1B[36mYour PUBLIC key is:\x1B[0m %65s\n", pub)
|
||||||
|
fmt.Printf("\x1B[33mYour PRIVATE key is (keep it secret):\x1B[0m %47s\n", pv)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue