Human friendly key and uid generators

pull/148/head
Andy Wang 3 years ago
parent a803d20970
commit 21bcb53062
No known key found for this signature in database
GPG Key ID: 181B49F9F38F3374

@ -165,9 +165,8 @@ is established.
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.
2. Run `ck-server -k`. The base64 string before the comma is the **public** key to be given to users, the one after the
comma is the **private** key to be kept secret.
3. Run `ck-server -u`. This will be used as the `AdminUID`.
2. Run `ck-server -key`. The **public** should be given to users, the **private** key should be kept secret.
3. Run `ck-server -uid`. The new UID will be used as `AdminUID`.
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.
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
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

@ -80,8 +80,11 @@ func main() {
askVersion := flag.Bool("v", false, "Print the version number")
printUsage := flag.Bool("h", false, "Print this message")
genUID := flag.Bool("u", false, "Generate a UID")
genKeyPair := flag.Bool("k", false, "Generate a pair of public and private key, output in the format of pubkey,pvkey")
genUIDScript := flag.Bool("u", false, "Generate a UID to STDOUT")
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")
verbosity := flag.String("verbosity", "info", "verbosity level")
@ -96,13 +99,23 @@ func main() {
flag.Usage()
return
}
if *genUID {
fmt.Println(generateUID())
if *genUIDScript || *genUIDHuman {
uid := generateUID()
if *genUIDScript {
fmt.Println(uid)
} else {
fmt.Printf("\x1B[35mYour UID is:\u001B[0m %s\n", uid)
}
return
}
if *genKeyPair {
if *genKeyPairScript || *genKeyPairHuman {
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
}

Loading…
Cancel
Save