static expressvpn list
This commit is contained in:
parent
c288f25dfe
commit
1f0de84b52
|
@ -1,2 +1,2 @@
|
|||
openvpn-mgt
|
||||
bindata_assetfs.go
|
||||
debian/openvpn-mgt.debhelper.log
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package main
|
||||
|
||||
// list dailymotion servers
|
||||
|
||||
type DailymotionVPN struct {
|
||||
}
|
||||
|
||||
func (s *DailymotionVPN) ServerList() (error, *map[string]string) {
|
||||
VPNNames := map[string]string{
|
||||
"Paris 1": "gate-01.dc3.dailymotion.com",
|
||||
"New-York 1": "gate-01.nyc.dailymotion.com",
|
||||
"Silicon Valley 1": "gate-01.sv6.dailymotion.com",
|
||||
"Singapore 1": "gate-01.sg1.dailymotion.com",
|
||||
"Tokyo 1": "gate-01.ty4.dailymotion.com",
|
||||
"Paris 2": "gate-02.ix7.dailymotion.com",
|
||||
"New-York 2": "gate-02.nyc.dailymotion.com",
|
||||
"Silicon Valley 2": "gate-02.sv6.dailymotion.com",
|
||||
"Singapore 2": "gate-02.sg1.dailymotion.com",
|
||||
"Tokyo 2": "gate-02.ty4.dailymotion.com",
|
||||
"default": "vpn.dailymotion.com",
|
||||
}
|
||||
return nil, &VPNNames
|
||||
}
|
|
@ -2,7 +2,7 @@ Source: openvpn-mgt
|
|||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Xavier Henner <xavier@euclide.org>
|
||||
Build-Depends: debhelper (>= 5), golang-1.11
|
||||
Build-Depends: debhelper (>= 5), golang-1.14
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: openvpn-mgt
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
openvpn-mgt_0.1.0-0_amd64.buildinfo net optional
|
||||
openvpn-mgt_0.1.0-0_amd64.deb net optional
|
|
@ -1,8 +0,0 @@
|
|||
# Automatically added by dh_installinit
|
||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
|
||||
if [ -x "/etc/init.d/openvpn-mgt" ]; then
|
||||
update-rc.d openvpn-mgt defaults >/dev/null
|
||||
invoke-rc.d openvpn-mgt start || exit $?
|
||||
fi
|
||||
fi
|
||||
# End automatically added section
|
|
@ -1,12 +0,0 @@
|
|||
# Automatically added by dh_installinit
|
||||
if [ "$1" = "purge" ] ; then
|
||||
update-rc.d openvpn-mgt remove >/dev/null
|
||||
fi
|
||||
|
||||
|
||||
# In case this system is running systemd, we make systemd reload the unit files
|
||||
# to pick up changes.
|
||||
if [ -d /run/systemd/system ] ; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
fi
|
||||
# End automatically added section
|
|
@ -1,5 +0,0 @@
|
|||
# Automatically added by dh_installinit
|
||||
if [ -x "/etc/init.d/openvpn-mgt" ]; then
|
||||
invoke-rc.d openvpn-mgt stop || exit $?
|
||||
fi
|
||||
# End automatically added section
|
218
expressvpn.go
218
expressvpn.go
|
@ -5,86 +5,174 @@ package main
|
|||
// remove until "Not supported" and after What the green checks mean
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ExpressVPN struct {
|
||||
}
|
||||
|
||||
func (s *ExpressVPN) ServerList() (error, *map[string]string) {
|
||||
var mux sync.Mutex
|
||||
requestCount := 0
|
||||
VPNNames := map[string]string{}
|
||||
|
||||
// Create HTTP client with timeout
|
||||
client := &http.Client{
|
||||
Timeout: 30 * time.Second,
|
||||
names := []string{
|
||||
"Albania",
|
||||
"Algeria",
|
||||
"Andorra",
|
||||
"Argentina",
|
||||
"Armenia",
|
||||
"Australia - Brisbane",
|
||||
"Australia - Melbourne",
|
||||
"Australia - Perth",
|
||||
"Australia - Sydney",
|
||||
"Australia - Sydney - 2",
|
||||
"Austria",
|
||||
"Bangladesh",
|
||||
"Belarus",
|
||||
"Belgium",
|
||||
"Bhutan",
|
||||
"Bosnia and Herzegovina",
|
||||
"Brazil",
|
||||
"Brazil - 2",
|
||||
"Brunei",
|
||||
"Bulgaria",
|
||||
"Cambodia",
|
||||
"Canada - Montreal",
|
||||
"Canada - Toronto",
|
||||
"Canada - Toronto - 2",
|
||||
"Canada - Vancouver",
|
||||
"Chile",
|
||||
"Colombia",
|
||||
"Costa Rica",
|
||||
"Croatia",
|
||||
"Cyprus",
|
||||
"Czech Republic",
|
||||
"Denmark",
|
||||
"Ecuador",
|
||||
"Egypt",
|
||||
"Estonia",
|
||||
"Finland",
|
||||
"France - Paris - 1",
|
||||
"France - Paris - 2",
|
||||
"France - Strasbourg",
|
||||
"Georgia ",
|
||||
"Germany - Frankfurt - 1",
|
||||
"Germany - Frankfurt - 2",
|
||||
"Germany - Frankfurt - 3",
|
||||
"Germany - Nuremberg",
|
||||
"Greece",
|
||||
"Guatemala",
|
||||
"Hong Kong - 1 ",
|
||||
"Hong Kong - 2",
|
||||
"Hong Kong - 4",
|
||||
"Hungary",
|
||||
"Iceland",
|
||||
"India - Chennai",
|
||||
"India - Mumbai - 1",
|
||||
"India (via UK)",
|
||||
"Indonesia",
|
||||
"Ireland",
|
||||
"Isle of Man",
|
||||
"Israel",
|
||||
"Italy - Cosenza",
|
||||
"Italy - Milan",
|
||||
"Japan - Tokyo",
|
||||
"Japan - Tokyo - 2",
|
||||
"Jersey",
|
||||
"Kazakhstan",
|
||||
"Kenya",
|
||||
"Kyrgyzstan",
|
||||
"Laos",
|
||||
"Latvia",
|
||||
"Liechtenstein",
|
||||
"Lithuania",
|
||||
"Luxembourg",
|
||||
"Macau",
|
||||
"Malaysia",
|
||||
"Malta",
|
||||
"Mexico",
|
||||
"Moldova",
|
||||
"Monaco",
|
||||
"Mongolia",
|
||||
"Montenegro",
|
||||
"Myanmar",
|
||||
"Nepal",
|
||||
"Netherlands - Amsterdam",
|
||||
"Netherlands - Amsterdam - 2",
|
||||
"Netherlands - Rotterdam",
|
||||
"Netherlands - The Hague",
|
||||
"New Zealand",
|
||||
"North Macedonia",
|
||||
"Norway",
|
||||
"Pakistan",
|
||||
"Panama",
|
||||
"Peru",
|
||||
"Philippines",
|
||||
"Poland",
|
||||
"Portugal",
|
||||
"Romania",
|
||||
"Serbia",
|
||||
"Singapore - CBD",
|
||||
"Singapore - Jurong",
|
||||
"Singapore - Marina Bay",
|
||||
"Slovakia",
|
||||
"Slovenia",
|
||||
"South Africa",
|
||||
"South Korea - 2",
|
||||
"Spain - Barcelona",
|
||||
"Spain - Barcelona - 2",
|
||||
"Spain - Madrid",
|
||||
"Sri Lanka",
|
||||
"Sweden",
|
||||
"Sweden - 2",
|
||||
"Switzerland",
|
||||
"Switzerland - 2",
|
||||
"Taiwan - 3",
|
||||
"Thailand",
|
||||
"Turkey",
|
||||
"UK - Docklands",
|
||||
"UK - East London",
|
||||
"UK - London",
|
||||
"Ukraine",
|
||||
"Uruguay",
|
||||
"USA - Atlanta",
|
||||
"USA - Chicago",
|
||||
"USA - Dallas",
|
||||
"USA - Dallas - 2",
|
||||
"USA - Denver",
|
||||
"USA - Los Angeles",
|
||||
"USA - Los Angeles - 1",
|
||||
"USA - Los Angeles - 2",
|
||||
"USA - Los Angeles - 3",
|
||||
"USA - Los Angeles - 5 ",
|
||||
"USA - Miami",
|
||||
"USA - Miami - 2",
|
||||
"USA - New Jersey - 1",
|
||||
"USA - New Jersey - 2",
|
||||
"USA - New Jersey - 3",
|
||||
"USA - New York",
|
||||
"USA - New York - 2",
|
||||
"USA - Salt Lake City",
|
||||
"USA - San Francisco",
|
||||
"USA - Seattle",
|
||||
"USA - Tampa - 1",
|
||||
"USA - Washington DC",
|
||||
"Uzbekistan",
|
||||
"Venezuela",
|
||||
"Vietnam",
|
||||
}
|
||||
|
||||
// Make request
|
||||
resp, err := client.Get("https://www.expressvpn.com/vpn-server")
|
||||
if err != nil {
|
||||
return err, nil
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return errors.New(fmt.Sprintf("Server List URL is not valid (%d)\n", resp.StatusCode)), nil
|
||||
}
|
||||
|
||||
buf := bufio.NewReader(bufio.NewReader(resp.Body))
|
||||
start := false
|
||||
for {
|
||||
line, err := buf.ReadString('\n')
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
line = strings.Trim(line, "\n\r ")
|
||||
if strings.HasPrefix(line, "<") {
|
||||
continue
|
||||
}
|
||||
if line == "Not supported" {
|
||||
start = true
|
||||
continue
|
||||
}
|
||||
if line == "What the green checks mean" {
|
||||
start = false
|
||||
}
|
||||
if !start {
|
||||
continue
|
||||
}
|
||||
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
requestCount++
|
||||
go func(line string) {
|
||||
for _, entry := range names {
|
||||
func(entry string) {
|
||||
conv := "%s-ca-version-2.expressnetw.com"
|
||||
line = strings.ToLower(line)
|
||||
line = strings.Replace(line, " & ", "", -1)
|
||||
line = strings.Replace(line, " ", "", -1)
|
||||
entry = strings.ToLower(entry)
|
||||
entry = strings.Replace(entry, " & ", "", -1)
|
||||
entry = strings.Replace(entry, " ", "", -1)
|
||||
|
||||
name := fmt.Sprintf(conv, line)
|
||||
if _, err := net.ResolveIPAddr("ip4", name); err == nil {
|
||||
mux.Lock()
|
||||
VPNNames[line] = name
|
||||
mux.Unlock()
|
||||
}
|
||||
requestCount--
|
||||
}(line)
|
||||
}
|
||||
|
||||
// wait for all resolutions
|
||||
for requestCount > 0 {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
name := fmt.Sprintf(conv, entry)
|
||||
VPNNames[entry] = name
|
||||
}(entry)
|
||||
}
|
||||
|
||||
if len(VPNNames) == 0 {
|
||||
|
|
26
go.mod
26
go.mod
|
@ -1,6 +1,28 @@
|
|||
module git.euclide.org/euclide/openvpn-mgt
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/pyke369/golang-support v0.0.0-20190703174728-34ca97aa79e9
|
||||
github.com/rakyll/statik v0.1.6
|
||||
9fans.net/go v0.0.2 // indirect
|
||||
github.com/alecthomas/gometalinter v3.0.0+incompatible // indirect
|
||||
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 // indirect
|
||||
github.com/fatih/gomodifytags v1.13.0 // indirect
|
||||
github.com/fatih/motion v1.1.0 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/josharian/impl v1.0.0 // indirect
|
||||
github.com/jstemmer/gotags v1.4.1 // indirect
|
||||
github.com/kisielk/errcheck v1.6.0 // indirect
|
||||
github.com/klauspost/asmfmt v1.2.3 // indirect
|
||||
github.com/nicksnyder/go-i18n v1.10.1 // indirect
|
||||
github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836 // indirect
|
||||
github.com/pelletier/go-toml v1.8.1 // indirect
|
||||
github.com/pyke369/golang-support v0.0.0-20210309170400-e309156a86e0
|
||||
github.com/rakyll/statik v0.1.7
|
||||
github.com/rogpeppe/godef v1.1.2 // indirect
|
||||
github.com/zmb3/gogetdoc v0.0.0-20190228002656-b37376c5da6a // indirect
|
||||
golang.org/x/mod v0.4.2 // indirect
|
||||
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 // indirect
|
||||
golang.org/x/tools v0.1.0 // indirect
|
||||
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
|
97
go.sum
97
go.sum
|
@ -1,4 +1,101 @@
|
|||
9fans.net/go v0.0.0-20181112161441-237454027057 h1:OcHlKWkAMJEF1ndWLGxp5dnJQkYM/YImUOvsBoz6h5E=
|
||||
9fans.net/go v0.0.0-20181112161441-237454027057/go.mod h1:diCsxrliIURU9xsYtjCp5AbpQKqdhKmf0ujWDUSkfoY=
|
||||
9fans.net/go v0.0.2 h1:RYM6lWITV8oADrwLfdzxmt8ucfW6UtP9v1jg4qAbqts=
|
||||
9fans.net/go v0.0.2/go.mod h1:lfPdxjq9v8pVQXUMBCx5EO5oLXWQFlKRQgs1kEkjoIM=
|
||||
github.com/alecthomas/gometalinter v1.2.1 h1:S75ABGzDRbD2pvSwevKl54Wj3RnTcf/wDaYqK5wtWU8=
|
||||
github.com/alecthomas/gometalinter v3.0.0+incompatible h1:e9Zfvfytsw/e6Kd/PYd75wggK+/kX5Xn8IYDUKyc5fU=
|
||||
github.com/alecthomas/gometalinter v3.0.0+incompatible/go.mod h1:qfIpQGGz3d+NmgyPBqv+LSh50emm1pt72EtcX2vKYQk=
|
||||
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 h1:AUNCr9CiJuwrRYS3XieqF+Z9B9gNxo/eANAJCF2eiN4=
|
||||
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
|
||||
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
|
||||
github.com/fatih/gomodifytags v1.13.0 h1:fmhwoecjZ5c34Q2chjRB9cL8Rgag+1TOSMy+grissMc=
|
||||
github.com/fatih/gomodifytags v1.13.0/go.mod h1:TbUyEjH1Zo0GkJd2Q52oVYqYcJ0eGNqG8bsiOb75P9c=
|
||||
github.com/fatih/motion v1.1.0 h1:Cvkgg+oR4QK25yKCJ8Ol7YXATJA6uOHBISJnSqZ0PXw=
|
||||
github.com/fatih/motion v1.1.0/go.mod h1:go/hyCtg5rx6FjoC0o+iInMzlY2u7OeHayKYDY6Gbmk=
|
||||
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
|
||||
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
|
||||
github.com/josharian/impl v1.0.0 h1:yMibyBqtigRRIK+47NGeIzPWJIPdj8DWvhHRp5gGZJQ=
|
||||
github.com/josharian/impl v1.0.0/go.mod h1:SQ6aJMP6xsJpGSD/36IIqrUdigLCYe9bz/9o5AKm6Aw=
|
||||
github.com/jstemmer/gotags v1.4.1 h1:aWIyXsU3lTDqhsEC49MP85p2cUUWr2ptvdGNqqGA3r4=
|
||||
github.com/jstemmer/gotags v1.4.1/go.mod h1:b6J3X0bsLbR4C5SgSx3V3KjuWTtmRzcmWPbTkWZ49PA=
|
||||
github.com/kisielk/errcheck v1.6.0 h1:YTDO4pNy7AUN/021p+JGHycQyYNIyMoenM1YDVK6RlY=
|
||||
github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/klauspost/asmfmt v1.2.3 h1:qEM7SLDo6DXXXz5yTpqUoxhsrtwH30nNR2riO2ZjznY=
|
||||
github.com/klauspost/asmfmt v1.2.3/go.mod h1:RAoUvqkWr2rUa2I19qKMEVZQe4BVtcHGTMCUOcCU2Lg=
|
||||
github.com/nicksnyder/go-i18n v1.10.1 h1:isfg77E/aCD7+0lD/D00ebR2MV5vgeQ276WYyDaCRQc=
|
||||
github.com/nicksnyder/go-i18n v1.10.1/go.mod h1:e4Di5xjP9oTVrC6y3C7C0HoSYXjSbhh/dU0eUV32nB4=
|
||||
github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836 h1:oc3CL18CoGhyOQJ7HDa9gJAde33bwI8Vi28zLdIzJVc=
|
||||
github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836/go.mod h1:6Q8/OMaaKAgTX7/jt2bOXVDrm1eJhoNd+iwzghR7jvs=
|
||||
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM=
|
||||
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pyke369/golang-support v0.0.0-20190703174728-34ca97aa79e9 h1:H1vjQ+Mfc8dFAOTuF541/tScdKoynzll9iKuWgaLLxM=
|
||||
github.com/pyke369/golang-support v0.0.0-20190703174728-34ca97aa79e9/go.mod h1:0XGrzgrEp0fa/+JSV8XZePUwyjnU6C3bMc7Xz2bHHKI=
|
||||
github.com/pyke369/golang-support v0.0.0-20210309170400-e309156a86e0 h1:3CDr/AqxwHlQp5yZmkwfZJOuiUJrYPTEpU7UfE54FE0=
|
||||
github.com/pyke369/golang-support v0.0.0-20210309170400-e309156a86e0/go.mod h1:0XGrzgrEp0fa/+JSV8XZePUwyjnU6C3bMc7Xz2bHHKI=
|
||||
github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs=
|
||||
github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs=
|
||||
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
|
||||
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
|
||||
github.com/rogpeppe/godef v1.1.2 h1:c5mCx0EcCORJOdVMREX7Lgh1raTxAHFmOfXdEB9u8Jw=
|
||||
github.com/rogpeppe/godef v1.1.2/go.mod h1:WtY9A/ovuQ+UakAJ1/CEqwwulX/WJjb2kgkokCHi/GY=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/zmb3/gogetdoc v0.0.0-20190228002656-b37376c5da6a h1:00UFliGZl2UciXe8o/2iuEsRQ9u7z0rzDTVzuj6EYY0=
|
||||
github.com/zmb3/gogetdoc v0.0.0-20190228002656-b37376c5da6a/go.mod h1:ofmGw6LrMypycsiWcyug6516EXpIxSbZ+uI9ppGypfY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 h1:46ULzRKLh1CwgRq2dC5SlBzEqqNCi8rreOZnNrbqcIY=
|
||||
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/tools v0.0.0-20180824175216-6c1c5e93cdc1/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20181207195948-8634b1ecd393/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200226224502-204d844ad48d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 h1:CEBpW6C191eozfEuWdUmIAHn7lwlLxJ7HVdr2e2Tsrw=
|
||||
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780/go.mod h1:3HH7i1SgMqlzxCcBmUHW657sD4Kvv9sC3HpL3YukzwA=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -23,9 +23,11 @@ import (
|
|||
)
|
||||
|
||||
type UConfig struct {
|
||||
input string
|
||||
config interface{}
|
||||
hash string
|
||||
cache map[string]interface{}
|
||||
separator string
|
||||
cacheLock sync.RWMutex
|
||||
sync.RWMutex
|
||||
}
|
||||
|
@ -136,14 +138,23 @@ func reduce(input interface{}) {
|
|||
|
||||
func New(input string, inline ...bool) (*UConfig, error) {
|
||||
config := &UConfig{
|
||||
config: nil,
|
||||
input: input,
|
||||
config: nil,
|
||||
separator: ".",
|
||||
}
|
||||
return config, config.Load(input, inline...)
|
||||
}
|
||||
|
||||
func (this *UConfig) Reload(inline ...bool) error {
|
||||
return this.Load(this.input, inline...)
|
||||
}
|
||||
|
||||
func (this *UConfig) SetSeparator(s string) {
|
||||
this.separator = s
|
||||
}
|
||||
|
||||
func (this *UConfig) Load(input string, inline ...bool) error {
|
||||
this.Lock()
|
||||
this.cache = map[string]interface{}{}
|
||||
base, _ := os.Getwd()
|
||||
content := fmt.Sprintf("/*base:%s*/\n", base)
|
||||
if len(inline) > 0 && inline[0] {
|
||||
|
@ -182,36 +193,36 @@ func (this *UConfig) Load(input string, inline ...bool) error {
|
|||
if arguments[0][0:1] != "/" {
|
||||
arguments[0] = fmt.Sprintf("%s/%s", base, arguments[0])
|
||||
}
|
||||
base = ""
|
||||
nbase := ""
|
||||
if elements, err := filepath.Glob(arguments[0]); err == nil {
|
||||
for _, element := range elements {
|
||||
if mcontent, err := ioutil.ReadFile(element); err == nil {
|
||||
base = filepath.Dir(element)
|
||||
nbase = filepath.Dir(element)
|
||||
expanded += string(mcontent)
|
||||
}
|
||||
}
|
||||
}
|
||||
if base != "" && strings.Index(expanded, "\n") >= 0 {
|
||||
expanded = fmt.Sprintf("/*base:%s*/\n%s\n", base, expanded)
|
||||
if nbase != "" && strings.Index(expanded, "\n") >= 0 {
|
||||
expanded = fmt.Sprintf("/*base:%s*/\n%s\n/*base:%s*/\n", nbase, expanded, base)
|
||||
}
|
||||
case "|":
|
||||
if arguments[0][0:1] != "/" {
|
||||
arguments[0] = fmt.Sprintf("%s/%s", base, arguments[0])
|
||||
}
|
||||
base = ""
|
||||
nbase := ""
|
||||
if elements, err := filepath.Glob(arguments[0]); err == nil {
|
||||
for _, element := range elements {
|
||||
if element[0:1] != "/" {
|
||||
element = fmt.Sprintf("%s/%s", base, element)
|
||||
}
|
||||
if mcontent, err := exec.Command(element, strings.Join(arguments[1:], " ")).Output(); err == nil {
|
||||
base = filepath.Dir(element)
|
||||
nbase = filepath.Dir(element)
|
||||
expanded += string(mcontent)
|
||||
}
|
||||
}
|
||||
}
|
||||
if base != "" && strings.Index(expanded, "\n") >= 0 {
|
||||
expanded = fmt.Sprintf("/*base:%s*/\n%s\n", base, expanded)
|
||||
if nbase != "" && strings.Index(expanded, "\n") >= 0 {
|
||||
expanded = fmt.Sprintf("/*base:%s*/\n%s\n/*base:%s*/\n", nbase, expanded, base)
|
||||
}
|
||||
case "@":
|
||||
requester := http.Client{
|
||||
|
@ -227,16 +238,27 @@ func (this *UConfig) Load(input string, inline ...bool) error {
|
|||
case "&":
|
||||
expanded += os.Getenv(arguments[0])
|
||||
case "!":
|
||||
arguments[0] = strings.ToLower(arguments[0])
|
||||
for index := 1; index < len(os.Args); index++ {
|
||||
option := strings.ToLower(os.Args[index])
|
||||
if option == "--"+arguments[0] {
|
||||
if index == len(os.Args)-1 || strings.HasPrefix(os.Args[index+1], "--") {
|
||||
expanded = "true"
|
||||
} else {
|
||||
expanded = os.Args[index+1]
|
||||
if matcher := rcache.Get(fmt.Sprintf(`(?i)^--?(no-?)?(?:%s)(?:(=)(.+))?$`, arguments[0])); matcher != nil {
|
||||
for index := 1; index < len(os.Args); index++ {
|
||||
option := os.Args[index]
|
||||
if option == "--" {
|
||||
break
|
||||
}
|
||||
if captures := matcher.FindStringSubmatch(option); captures != nil {
|
||||
if captures[2] == "=" {
|
||||
expanded = captures[3]
|
||||
} else {
|
||||
if index == len(os.Args)-1 || strings.HasPrefix(os.Args[index+1], "-") {
|
||||
expanded = "true"
|
||||
if captures[1] != "" {
|
||||
expanded = "false"
|
||||
}
|
||||
} else {
|
||||
expanded = os.Args[index+1]
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
case "-":
|
||||
|
@ -258,15 +280,14 @@ func (this *UConfig) Load(input string, inline ...bool) error {
|
|||
content = fmt.Sprintf("%s%s%s", content[0:indexes[0]], expanded, content[indexes[1]:len(content)])
|
||||
}
|
||||
|
||||
this.hash = fmt.Sprintf("%x", sha1.Sum([]byte(content)))
|
||||
if err := json.Unmarshal([]byte(content), &this.config); err != nil {
|
||||
if err := json.Unmarshal([]byte("{"+content+"}"), &this.config); err != nil {
|
||||
this.config = nil
|
||||
var config interface{}
|
||||
if err := json.Unmarshal([]byte(content), &config); err != nil {
|
||||
if err := json.Unmarshal([]byte("{"+content+"}"), &config); err != nil {
|
||||
if syntax, ok := err.(*json.SyntaxError); ok && syntax.Offset < int64(len(content)) {
|
||||
if start := strings.LastIndex(content[:syntax.Offset], "\n") + 1; start >= 0 {
|
||||
line := strings.Count(content[:start], "\n") + 1
|
||||
this.Unlock()
|
||||
return errors.New(fmt.Sprintf("%s at line %d near %s", syntax, line, content[start:syntax.Offset]))
|
||||
return fmt.Errorf("uconfig: %s at line %d near %s", syntax, line, content[start:syntax.Offset])
|
||||
}
|
||||
}
|
||||
this.Unlock()
|
||||
|
@ -274,6 +295,9 @@ func (this *UConfig) Load(input string, inline ...bool) error {
|
|||
}
|
||||
}
|
||||
|
||||
this.config = config
|
||||
this.hash = fmt.Sprintf("%x", sha1.Sum([]byte(content)))
|
||||
this.cache = map[string]interface{}{}
|
||||
reduce(this.config)
|
||||
this.Unlock()
|
||||
return nil
|
||||
|
@ -320,8 +344,8 @@ func (this *UConfig) GetPaths(path string) []string {
|
|||
}
|
||||
this.cacheLock.RUnlock()
|
||||
if path != "" {
|
||||
prefix = "."
|
||||
for _, part := range strings.Split(path, ".") {
|
||||
prefix = this.separator
|
||||
for _, part := range strings.Split(path, this.separator) {
|
||||
kind := reflect.TypeOf(current).Kind()
|
||||
index, err := strconv.Atoi(part)
|
||||
if (kind == reflect.Slice && (err != nil || index < 0 || index >= len(current.([]interface{})))) || (kind != reflect.Slice && kind != reflect.Map) {
|
||||
|
@ -367,14 +391,14 @@ func (this *UConfig) value(path string) (string, error) {
|
|||
this.RLock()
|
||||
if current == nil || path == "" {
|
||||
this.RUnlock()
|
||||
return "", fmt.Errorf("invalid parameter")
|
||||
return "", errors.New(`uconfig: invalid parameter`)
|
||||
}
|
||||
this.cacheLock.RLock()
|
||||
if this.cache[path] != nil {
|
||||
if current, ok := this.cache[path].(bool); ok && !current {
|
||||
this.cacheLock.RUnlock()
|
||||
this.RUnlock()
|
||||
return "", fmt.Errorf("invalid path")
|
||||
return "", errors.New(`uconfig: invalid path`)
|
||||
}
|
||||
if current, ok := this.cache[path].(string); ok {
|
||||
this.cacheLock.RUnlock()
|
||||
|
@ -383,7 +407,7 @@ func (this *UConfig) value(path string) (string, error) {
|
|||
}
|
||||
}
|
||||
this.cacheLock.RUnlock()
|
||||
for _, part := range strings.Split(path, ".") {
|
||||
for _, part := range strings.Split(path, this.separator) {
|
||||
kind := reflect.TypeOf(current).Kind()
|
||||
index, err := strconv.Atoi(part)
|
||||
if (kind == reflect.Slice && (err != nil || index < 0 || index >= len(current.([]interface{})))) || (kind != reflect.Slice && kind != reflect.Map) {
|
||||
|
@ -391,7 +415,7 @@ func (this *UConfig) value(path string) (string, error) {
|
|||
this.cache[path] = false
|
||||
this.cacheLock.Unlock()
|
||||
this.RUnlock()
|
||||
return "", fmt.Errorf("invalid path")
|
||||
return "", errors.New(`uconfig: invalid path`)
|
||||
}
|
||||
if kind == reflect.Slice {
|
||||
current = current.([]interface{})[index]
|
||||
|
@ -401,7 +425,7 @@ func (this *UConfig) value(path string) (string, error) {
|
|||
this.cache[path] = false
|
||||
this.cacheLock.Unlock()
|
||||
this.RUnlock()
|
||||
return "", fmt.Errorf("invalid path")
|
||||
return "", errors.New(`uconfig: invalid path`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +440,7 @@ func (this *UConfig) value(path string) (string, error) {
|
|||
this.cache[path] = false
|
||||
this.cacheLock.Unlock()
|
||||
this.RUnlock()
|
||||
return "", fmt.Errorf("invalid path")
|
||||
return "", errors.New(`uconfig: invalid path`)
|
||||
}
|
||||
|
||||
func (this *UConfig) GetBoolean(path string, fallback bool) bool {
|
||||
|
@ -566,3 +590,28 @@ func (this *UConfig) GetDurationBounds(path string, fallback, min, max float64)
|
|||
}
|
||||
return math.Max(math.Min(nvalue, max), min)
|
||||
}
|
||||
|
||||
func Duration(input float64) time.Duration {
|
||||
return time.Duration(input * float64(time.Second))
|
||||
}
|
||||
|
||||
func Args() (args []string) {
|
||||
for index := 1; index < len(os.Args); index++ {
|
||||
option := os.Args[index]
|
||||
if args == nil {
|
||||
if option[0] == '-' {
|
||||
if option != "-" && option != "--" && strings.Index(option, "=") < 0 && index < len(os.Args)-1 && os.Args[index+1][0] != '-' {
|
||||
index++
|
||||
}
|
||||
} else {
|
||||
args = []string{}
|
||||
}
|
||||
}
|
||||
if args != nil {
|
||||
args = append(args, option)
|
||||
} else if option == "--" {
|
||||
args = []string{}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -25,12 +25,13 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var zipData string
|
||||
var zipData = map[string]string{}
|
||||
|
||||
// file holds unzipped read-only file contents and file metadata.
|
||||
type file struct {
|
||||
|
@ -44,19 +45,40 @@ type statikFS struct {
|
|||
dirs map[string][]string
|
||||
}
|
||||
|
||||
const defaultNamespace = "default"
|
||||
|
||||
// IsDefaultNamespace returns true if the assetNamespace is
|
||||
// the default one
|
||||
func IsDefaultNamespace(assetNamespace string) bool {
|
||||
return assetNamespace == defaultNamespace
|
||||
}
|
||||
|
||||
// Register registers zip contents data, later used to initialize
|
||||
// the statik file system.
|
||||
func Register(data string) {
|
||||
zipData = data
|
||||
RegisterWithNamespace(defaultNamespace, data)
|
||||
}
|
||||
|
||||
// New creates a new file system with the registered zip contents data.
|
||||
// RegisterWithNamespace registers zip contents data and set asset namespace,
|
||||
// later used to initialize the statik file system.
|
||||
func RegisterWithNamespace(assetNamespace string, data string) {
|
||||
zipData[assetNamespace] = data
|
||||
}
|
||||
|
||||
// New creates a new file system with the default registered zip contents data.
|
||||
// It unzips all files and stores them in an in-memory map.
|
||||
func New() (http.FileSystem, error) {
|
||||
if zipData == "" {
|
||||
return NewWithNamespace(defaultNamespace)
|
||||
}
|
||||
|
||||
// NewWithNamespace creates a new file system with the registered zip contents data.
|
||||
// It unzips all files and stores them in an in-memory map.
|
||||
func NewWithNamespace(assetNamespace string) (http.FileSystem, error) {
|
||||
asset, ok := zipData[assetNamespace]
|
||||
if !ok {
|
||||
return nil, errors.New("statik/fs: no zip data registered")
|
||||
}
|
||||
zipReader, err := zip.NewReader(strings.NewReader(zipData), int64(len(zipData)))
|
||||
zipReader, err := zip.NewReader(strings.NewReader(asset), int64(len(asset)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -108,21 +130,12 @@ func (di dirInfo) ModTime() time.Time { return time.Time{} }
|
|||
func (di dirInfo) IsDir() bool { return true }
|
||||
func (di dirInfo) Sys() interface{} { return nil }
|
||||
|
||||
func unzip(zf *zip.File) ([]byte, error) {
|
||||
rc, err := zf.Open()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rc.Close()
|
||||
return ioutil.ReadAll(rc)
|
||||
}
|
||||
|
||||
// Open returns a file matching the given file name, or os.ErrNotExists if
|
||||
// no file matching the given file name is found in the archive.
|
||||
// If a directory is requested, Open returns the file named "index.html"
|
||||
// in the requested directory, if that file exists.
|
||||
func (fs *statikFS) Open(name string) (http.File, error) {
|
||||
name = strings.Replace(name, "//", "/", -1)
|
||||
name = filepath.ToSlash(filepath.Clean(name))
|
||||
if f, ok := fs.files[name]; ok {
|
||||
return newHTTPFile(f), nil
|
||||
}
|
||||
|
@ -182,7 +195,7 @@ func (f *httpFile) Readdir(count int) ([]os.FileInfo, error) {
|
|||
}
|
||||
|
||||
// If count is positive, the specified number of files will be returned,
|
||||
// and if negative, all remaining files will be returned.
|
||||
// and if non-positive, all remaining files will be returned.
|
||||
// The reading position of which file is returned is held in dirIndex.
|
||||
fnames := f.file.fs.dirs[di.name]
|
||||
flen := len(fnames)
|
||||
|
@ -196,7 +209,7 @@ func (f *httpFile) Readdir(count int) ([]os.FileInfo, error) {
|
|||
return fis, io.EOF
|
||||
}
|
||||
var end int
|
||||
if count < 0 {
|
||||
if count <= 0 {
|
||||
end = flen
|
||||
} else {
|
||||
end = start + count
|
||||
|
@ -214,3 +227,12 @@ func (f *httpFile) Readdir(count int) ([]os.FileInfo, error) {
|
|||
func (f *httpFile) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func unzip(zf *zip.File) ([]byte, error) {
|
||||
rc, err := zf.Open()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rc.Close()
|
||||
return ioutil.ReadAll(rc)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,47 @@
|
|||
# github.com/pyke369/golang-support v0.0.0-20190703174728-34ca97aa79e9
|
||||
# 9fans.net/go v0.0.2
|
||||
## explicit
|
||||
# github.com/alecthomas/gometalinter v3.0.0+incompatible
|
||||
## explicit
|
||||
# github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15
|
||||
## explicit
|
||||
# github.com/fatih/gomodifytags v1.13.0
|
||||
## explicit
|
||||
# github.com/fatih/motion v1.1.0
|
||||
## explicit
|
||||
# github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
||||
## explicit
|
||||
# github.com/josharian/impl v1.0.0
|
||||
## explicit
|
||||
# github.com/jstemmer/gotags v1.4.1
|
||||
## explicit
|
||||
# github.com/kisielk/errcheck v1.6.0
|
||||
## explicit
|
||||
# github.com/klauspost/asmfmt v1.2.3
|
||||
## explicit
|
||||
# github.com/nicksnyder/go-i18n v1.10.1
|
||||
## explicit
|
||||
# github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836
|
||||
## explicit
|
||||
# github.com/pelletier/go-toml v1.8.1
|
||||
## explicit
|
||||
# github.com/pyke369/golang-support v0.0.0-20210309170400-e309156a86e0
|
||||
## explicit
|
||||
github.com/pyke369/golang-support/rcache
|
||||
github.com/pyke369/golang-support/uconfig
|
||||
# github.com/rakyll/statik v0.1.6
|
||||
# github.com/rakyll/statik v0.1.7
|
||||
## explicit
|
||||
github.com/rakyll/statik/fs
|
||||
# github.com/rogpeppe/godef v1.1.2
|
||||
## explicit
|
||||
# github.com/zmb3/gogetdoc v0.0.0-20190228002656-b37376c5da6a
|
||||
## explicit
|
||||
# golang.org/x/mod v0.4.2
|
||||
## explicit
|
||||
# golang.org/x/sys v0.0.0-20210309074719-68d13333faf2
|
||||
## explicit
|
||||
# golang.org/x/tools v0.1.0
|
||||
## explicit
|
||||
# gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780
|
||||
## explicit
|
||||
# gopkg.in/yaml.v2 v2.4.0
|
||||
## explicit
|
||||
|
|
|
@ -13,10 +13,6 @@ func (s *OpenVpnMgt) getServerList(provider string) error {
|
|||
return nil
|
||||
}
|
||||
switch provider {
|
||||
case "dailymotion":
|
||||
list := DailymotionVPN{}
|
||||
err, s.VpnRemotes[provider] = list.ServerList()
|
||||
return err
|
||||
case "expressvpn":
|
||||
list := ExpressVPN{}
|
||||
err, s.VpnRemotes[provider] = list.ServerList()
|
||||
|
|
Loading…
Reference in New Issue