This file contains hidden or 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
package main | |
import ( | |
"bufio" | |
"bytes" | |
"compress/gzip" | |
"encoding/binary" | |
"fmt" | |
"io" | |
"os" |
This file contains hidden or 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
package main | |
// -- start service --- | |
// $ env GOGO_LISTEN='*:8000' GOGO_ALIASES=aliases.json GOGO_BACKUP=true GOGO_KEY=my-secret-key go run go.go | |
// --- manage aliases --- | |
// $ curl -H 'Authorization: Key my-secret-key' -X PATCH http://localhost:8000/.well-known/gogo -d '{ "sib":"https://www.stream-in-box.com", "goo":"https://www.google.com" }' | |
// {"created":["sib","goo"],"deleted":[],"modified":[]} | |
// | |
// $ cat aliases.json |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" | |
"regexp" | |
"strconv" | |
"strings" |
This file contains hidden or 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
package main | |
import ( | |
"encoding/binary" | |
"encoding/hex" | |
"flag" | |
"fmt" | |
"math" | |
"math/rand" | |
"net" |
This file contains hidden or 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
// -- build --- | |
// native go build gotp.go | |
// ARM 32bits GOOS=linux GOARCH=arm go build gotp.go | |
// MacOS 64bits GOOS=darwin GOARCH=amd64 go build gotp.go | |
// -- usage -- | |
// gotp <login> <password> <base32-otp-secret> <write-mode> <auth-file-path> | |
// gotp j.doe Pn76sk 3HPLQ9GT5TKB3 - /tmp/auth.txt | |
// -- OpenVPN configuration file -- |