From d83dbc7bdb7c238111427ca98cbe1768163b7cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=AA=E6=98=8C=E6=96=B0?= Date: Sat, 14 Mar 2020 00:47:42 +0800 Subject: [PATCH] Rename to my-token --- .travis.yml | 6 +-- README.md | 50 +++++++++---------- config/config.go | 21 ++++---- exchange/bigone.go | 4 +- exchange/binance.go | 4 +- exchange/bitfinex.go | 4 +- exchange/bittrex.go | 4 +- exchange/coinbase.go | 4 +- exchange/coinmarketcap.go | 4 +- exchange/gate.go | 4 +- exchange/hitbtc.go | 4 +- exchange/huobi.go | 4 +- exchange/kraken.go | 4 +- exchange/okex.go | 4 +- exchange/poloniex.go | 4 +- exchange/zb.go | 4 +- go.mod | 23 +++------ go.sum | 27 +++++++++- http/http.go | 4 +- install.sh | 10 ++-- main.go | 16 +++--- ...cker.example.yaml => my_token.example.yaml | 0 writer/table.go | 2 +- 23 files changed, 114 insertions(+), 97 deletions(-) rename token_ticker.example.yaml => my_token.example.yaml (100%) diff --git a/.travis.yml b/.travis.yml index 0440784..04bf467 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,11 +13,11 @@ env: script: - go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... - - go run *.go -d -c token_ticker.example.yaml + - go run *.go -d -c my_token.example.yaml after_success: # Ensure download script works - - curl -sfL https://raw.githubusercontent.com/polyrabbit/token-ticker/master/install.sh | bash -s -- -d + - curl -sfL https://raw.githubusercontent.com/polyrabbit/my-token/master/install.sh | bash -s -- -d - bash <(curl -s https://codecov.io/bash) before_deploy: @@ -25,7 +25,7 @@ before_deploy: - go get -u github.com/mitchellh/gox - go get -u github.com/tcnksm/ghr - - gox -output "release/tt_{{.OS}}_{{.Arch}}/tt" -ldflags "-X github.com/polyrabbit/token-ticker/config.Rev=`git rev-parse --short HEAD` -X github.com/polyrabbit/token-ticker/config.Version=`git describe --tags | cut -dv -f 2` -X 'github.com/polyrabbit/token-ticker/config.exampleConfig=`cat token_ticker.example.yaml`'" -verbose + - gox -output "release/mt_{{.OS}}_{{.Arch}}/mt" -ldflags "-X github.com/polyrabbit/my-token/config.Rev=`git rev-parse --short HEAD` -X github.com/polyrabbit/my-token/config.Version=`git describe --tags | cut -dv -f 2` -X 'github.com/polyrabbit/my-token/config.exampleConfig=`cat my_token.example.yaml`'" -verbose - mkdir -p dist - for f in release/*; do if [[ -d "$f" ]]; then diff --git a/README.md b/README.md index fa63c63..bdfd939 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# Token Ticker +# My Token -[![Build Status](https://travis-ci.org/polyrabbit/token-ticker.svg?branch=master)](https://travis-ci.org/polyrabbit/token-ticker) -[![codecov](https://codecov.io/gh/polyrabbit/token-ticker/branch/master/graph/badge.svg)](https://codecov.io/gh/polyrabbit/token-ticker) +[![Build Status](https://travis-ci.org/polyrabbit/my-token.svg?branch=master)](https://travis-ci.org/polyrabbit/my-token) +[![codecov](https://codecov.io/gh/polyrabbit/my-token/branch/master/graph/badge.svg)](https://codecov.io/gh/polyrabbit/my-token) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/polyrabbit/token-ticker/pulls) -[![Go Report Card](https://goreportcard.com/badge/github.com/polyrabbit/token-ticker)](https://goreportcard.com/report/github.com/polyrabbit/token-ticker) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/polyrabbit/my-token/pulls) +[![Go Report Card](https://goreportcard.com/badge/github.com/polyrabbit/my-token)](https://goreportcard.com/report/github.com/polyrabbit/my-token) > NEVER LEAVE YOUR TERMINAL -![token-ticker](https://user-images.githubusercontent.com/2657334/40175207-ff9e6504-5a09-11e8-9a3d-a887ebc4895a.png) +![my-token](https://user-images.githubusercontent.com/2657334/40175207-ff9e6504-5a09-11e8-9a3d-a887ebc4895a.png) -Token-ticker (or `tt` for short) is a CLI tool for those who are both **Crypto investors** and **Engineers**, allowing you to track token prices and changes in your favorite exchanges on the terminal. +my-token (or `mt` for short) is a CLI tool for those who are both **Crypto investors** and **Engineers**, allowing you to track token prices and changes in your favorite exchanges on the terminal. ### Features @@ -45,23 +45,23 @@ Token-ticker (or `tt` for short) is a CLI tool for those who are both **Crypto i #### `curl | bash` style downloads to `/usr/local/bin` ```bash -$ curl -sfL https://raw.githubusercontent.com/polyrabbit/token-ticker/master/install.sh | bash -s -- -d -b /usr/local/bin +$ curl -sfL https://raw.githubusercontent.com/polyrabbit/my-token/master/install.sh | bash -s -- -d -b /usr/local/bin ``` #### Using [Go](https://golang.org/) (1.12+) ```bash -$ go get -u github.com/polyrabbit/token-ticker +$ go get -u github.com/polyrabbit/my-token ``` #### Manually -Download from [release page](https://github.com/polyrabbit/token-ticker/releases/latest) and extact the tarbal into /usr/bin or your `PATH` directory. +Download from [release page](https://github.com/polyrabbit/my-token/releases/latest) and extract the tarbal into /usr/bin or your `PATH` directory. ### Usage ``` -$ tt --help +$ mt --help -Usage: tt [Options] [Exchange1.Token1 Exchange2.Token2 ...] +Usage: mt [Options] [Exchange1.Token1 Exchange2.Token2 ...] Track token prices of your favorite exchanges in the terminal @@ -72,23 +72,23 @@ Options: -r, --refresh int Auto refresh on every specified seconds, note every exchange has a rate limit, too frequent refresh may cause your IP banned by their servers -c, --config-file string Config file path, use "--example-config-file " to generate an example config file, - by default token-ticker uses "token_ticker.yml" in current directory or $HOME as config file + by default my-token uses "my_token.yml" in current directory or $HOME as config file --example-config-file string[="-"] Generate example config file to the specified file path, by default it outputs to stdout -s, --show strings Only show comma-separated columns (default [Symbol,Price,%Change(1h),%Change(24h),Source,Updated]) -p, --proxy string Proxy used when sending HTTP request (eg. "http://localhost:7777", "https://localhost:7777", "socks5://localhost:1080") -t, --timeout int HTTP request timeout in seconds (default 20) -Exchange.Token Pairs: +Space-separated exchange.token pairs: Specify which exchange and token pair to query, different exchanges use different forms to express tokens/trading pairs, refer to their URLs to find the format, eg. to get BitCoin price from Bitfinex and CoinMarketCap you should use query string "Bitfinex.BTCUSDT CoinMarketCap.Bitcoin" -Find help/updates from here - https://github.com/polyrabbit/token-ticker +Find help/updates from here - https://github.com/polyrabbit/my-token ``` * #### Display latest market prices for for `BNBUSDT`, `BTCUSDT` from `Binance` and `HTUSDT` from `Huobi` ```bash -$ tt binance.BNBUSDT binance.BTCUSDT Huobi.HTUSDT +$ mt binance.BNBUSDT binance.BTCUSDT Huobi.HTUSDT ``` Here `Binance` and `Huobi` can be replaced by any supported exchanges, and different exchanges use different forms to express tokens/symbols/markets, refer to their URLs to find the format. @@ -96,7 +96,7 @@ Here `Binance` and `Huobi` can be replaced by any supported exchanges, and diffe * #### Auto-refresh on every 10 seconds ```bash -$ tt -r 10 binance.BNBUSDT binance.BTCUSDT Huobi.HTUSDT +$ mt -r 10 binance.BNBUSDT binance.BTCUSDT Huobi.HTUSDT ``` NOTE: some exchanges has a strict rate limit, too frequent refresh may cause your IP banned by their servers. @@ -104,26 +104,26 @@ NOTE: some exchanges has a strict rate limit, too frequent refresh may cause you * #### Show specified columns only ```bash -$ tt --show Symbol,Price binance.BTCUSDT +$ mt --show Symbol,Price binance.BTCUSDT ``` -See issue [#3](https://github.com/polyrabbit/token-ticker/issues/3) for a discussion on this feature. +See issue [#3](https://github.com/polyrabbit/my-token/issues/3) for a discussion on this feature. * #### Run with options from a configuration file ```bash -$ tt -c token_ticker.example.yaml +$ mt -c my_token.example.yaml ``` -Token-ticker can also read options from configuration file, see the attached [token_ticker.example.yaml](token_ticker.example.yaml) for its format. By default token-ticker searches configuration file `token_ticker.yml` in current directory and `$HOME`, so you can compose a `token_ticker.yml`, place it in your `$HOME` and just type `tt` to get all pre-defined prices. +my-token can also read options from configuration file, see the attached [my_token.example.yaml](my_token.example.yaml) for its format. By default my-token searches configuration file `my_token.yml` in current directory and `$HOME`, so you can compose a `my_token.yml`, place it in your `$HOME` and just type `mt` to get all pre-defined prices. ```bash $ # Generate an example config file to my $HOME directory -$ tt --example-config-file=$HOME/token_ticker.yml +$ mt --example-config-file=$HOME/my_token.yml $ $ -$ # token-ticker will search for configuration file "token_ticker.yml" in current directory and "$HOME" by default -$ tt # <--- This is also the way I used most freqently +$ # my-token will search for configuration file "my_token.yml" in current directory and "$HOME" by default +$ mt # <--- This is also the way I used most freqently ``` ### Thanks @@ -132,4 +132,4 @@ $ tt # <--- This is also the way I used most freqently ### License -The MIT License (MIT) - see [LICENSE.md](https://github.com/polyrabbit/token-ticker/blob/master/LICENSE) for more details +The MIT License (MIT) - see [LICENSE.md](https://github.com/polyrabbit/my-token/blob/master/LICENSE) for more details diff --git a/config/config.go b/config/config.go index 760bc35..41306f5 100644 --- a/config/config.go +++ b/config/config.go @@ -5,10 +5,10 @@ import ( "os" "strings" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" "github.com/mattn/go-colorable" - "github.com/polyrabbit/token-ticker/writer" + "github.com/polyrabbit/my-token/writer" "github.com/sirupsen/logrus" "github.com/spf13/pflag" "github.com/spf13/viper" @@ -21,7 +21,7 @@ var ( exampleConfig string ) -func init() { +func Parse() { // Set log format formatter := &logrus.TextFormatter{ FullTimestamp: true, @@ -41,7 +41,7 @@ func init() { var configFile string pflag.StringVarP(&configFile, "config-file", "c", "", `Config file path, use "--example-config-file " `+ "to generate an example config file,\n"+ - "by default token-ticker uses \"token_ticker.yml\" in current directory or $HOME as config file") + "by default my-token uses \"my_token.yml\" in current directory or $HOME as config file") var exampleConfigFile string pflag.StringVar(&exampleConfigFile, "example-config-file", "", "Generate example config file to the specified file path, by default it outputs to stdout") @@ -83,10 +83,11 @@ func init() { viper.BindPFlags(pflag.CommandLine) // Set configure file - viper.SetConfigName("token_ticker") // name of config file (without extension) - viper.AddConfigPath(".") // path to look for the config file in - viper.AddConfigPath("$HOME") // optionally look for config in the HOME directory - viper.AddConfigPath("/etc") // and /etc + viper.SetConfigName("my_token") // name of config file (without extension) + // viper.SetConfigName("token_ticker") // for compatibility reason + viper.AddConfigPath(".") // path to look for the config file in + viper.AddConfigPath("$HOME") // optionally look for config in the HOME directory + viper.AddConfigPath("/etc") // and /etc if configFile != "" { viper.SetConfigFile(configFile) } @@ -113,10 +114,10 @@ func showUsageAndExit() { fmt.Fprintln(os.Stderr, "\nTrack token prices of your favorite exchanges in the terminal") fmt.Fprintln(os.Stderr, "\nOptions:") pflag.PrintDefaults() - fmt.Fprintln(os.Stderr, "\nExchange.Token Pairs:") + fmt.Fprintln(os.Stderr, "\nSpace-separated exchange.token pairs:") fmt.Fprintln(os.Stderr, " Specify which exchange and token pair to query, different exchanges use different forms to express tokens/trading pairs, refer to their URLs to find the format"+ " (eg. to get BitCoin price from Bitfinex and CoinMarketCap you should use query string \"Bitfinex.BTCUSDT CoinMarketCap.Bitcoin\").") - fmt.Fprintln(os.Stderr, "\nFind help/updates from here - https://github.com/polyrabbit/token-ticker") + fmt.Fprintln(os.Stderr, "\nFind help/updates from here - https://github.com/polyrabbit/my-token") os.Exit(0) } diff --git a/exchange/bigone.go b/exchange/bigone.go index 2e76a98..56e2561 100644 --- a/exchange/bigone.go +++ b/exchange/bigone.go @@ -9,9 +9,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/binance.go b/exchange/binance.go index f0638d4..16b61dc 100644 --- a/exchange/binance.go +++ b/exchange/binance.go @@ -9,9 +9,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/bitfinex.go b/exchange/bitfinex.go index 36d5744..433ef46 100644 --- a/exchange/bitfinex.go +++ b/exchange/bitfinex.go @@ -9,9 +9,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/bittrex.go b/exchange/bittrex.go index a191ba8..b523869 100644 --- a/exchange/bittrex.go +++ b/exchange/bittrex.go @@ -10,9 +10,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/coinbase.go b/exchange/coinbase.go index dbc66dd..012b511 100644 --- a/exchange/coinbase.go +++ b/exchange/coinbase.go @@ -7,9 +7,9 @@ import ( "strconv" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/preichenberger/go-coinbasepro/v2" "github.com/sirupsen/logrus" ) diff --git a/exchange/coinmarketcap.go b/exchange/coinmarketcap.go index 9495532..cb54125 100644 --- a/exchange/coinmarketcap.go +++ b/exchange/coinmarketcap.go @@ -6,9 +6,9 @@ import ( "fmt" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" ) // https://coinmarketcap.com/api/ diff --git a/exchange/gate.go b/exchange/gate.go index ac90a4f..46a8430 100644 --- a/exchange/gate.go +++ b/exchange/gate.go @@ -9,9 +9,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/hitbtc.go b/exchange/hitbtc.go index f7b7af0..8c79302 100644 --- a/exchange/hitbtc.go +++ b/exchange/hitbtc.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/huobi.go b/exchange/huobi.go index 93e5f4b..e69fe1f 100644 --- a/exchange/huobi.go +++ b/exchange/huobi.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/kraken.go b/exchange/kraken.go index 27d9397..10e662b 100644 --- a/exchange/kraken.go +++ b/exchange/kraken.go @@ -8,10 +8,10 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" "github.com/buger/jsonparser" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/okex.go b/exchange/okex.go index d1ef279..00a4adc 100644 --- a/exchange/okex.go +++ b/exchange/okex.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/poloniex.go b/exchange/poloniex.go index b382dcb..8d8683d 100644 --- a/exchange/poloniex.go +++ b/exchange/poloniex.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/exchange/zb.go b/exchange/zb.go index 854ea19..8430de7 100644 --- a/exchange/zb.go +++ b/exchange/zb.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "github.com/polyrabbit/token-ticker/exchange/model" + "github.com/polyrabbit/my-token/exchange/model" - "github.com/polyrabbit/token-ticker/http" + "github.com/polyrabbit/my-token/http" "github.com/sirupsen/logrus" ) diff --git a/go.mod b/go.mod index 2d48958..bb810bd 100644 --- a/go.mod +++ b/go.mod @@ -1,25 +1,18 @@ -module github.com/polyrabbit/token-ticker +module github.com/polyrabbit/my-token + +go 1.12 require ( github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456 github.com/fatih/color v0.0.0-20180213133403-507f6050b856 - github.com/gorilla/websocket v1.4.1 // indirect github.com/gosuri/uilive v0.0.4 - github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect - github.com/magiconair/properties v1.8.1 // indirect github.com/mattn/go-colorable v0.0.0-20180310133214-efa589957cd0 - github.com/mattn/go-isatty v0.0.0-20171107050531-6ca4dbf54d38 // indirect - github.com/mattn/go-runewidth v0.0.0-20180408055351-ce7b0b5c7b45 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-runewidth v0.0.8 // indirect + github.com/mitchellh/gox v1.0.1 // indirect github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84 - github.com/pelletier/go-toml v1.5.0 // indirect - github.com/preichenberger/go-coinbasepro/v2 v2.0.4 + github.com/preichenberger/go-coinbasepro/v2 v2.0.5 github.com/sirupsen/logrus v1.4.2 - github.com/spf13/afero v1.2.2 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.6.1 - github.com/stretchr/testify v1.4.0 // indirect - golang.org/x/sys v0.0.0-20191018095205-727590c5006e // indirect - golang.org/x/text v0.3.2 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + github.com/spf13/viper v1.6.2 ) diff --git a/go.sum b/go.sum index 843de11..45739eb 100644 --- a/go.sum +++ b/go.sum @@ -40,25 +40,29 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gosuri/uilive v0.0.3 h1:kvo6aB3pez9Wbudij8srWo4iY6SFTTxTKOkb+uRCE8I= github.com/gosuri/uilive v0.0.3/go.mod h1:qkLSc0A5EXSP6B04TrN4oQoxqFI7A8XvoXSlJi8cwk8= github.com/gosuri/uilive v0.0.4 h1:hUEBpQDj8D8jXgtCdBu7sWsy5sbW/5GhuO8KBwJ2jyY= github.com/gosuri/uilive v0.0.4/go.mod h1:V/epo5LjjlDE5RJUcqx8dbw+zc93y5Ya3yg8tfZ74VI= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/go-version v1.0.0 h1:21MVWPKDphxa7ineQQTrCU5brh7OuVVAzGOCnnCPtE8= +github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -75,15 +79,24 @@ github.com/mattn/go-colorable v0.0.0-20180310133214-efa589957cd0 h1:cDvUG90i1ssG github.com/mattn/go-colorable v0.0.0-20180310133214-efa589957cd0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.0-20171107050531-6ca4dbf54d38 h1:eIoKWEzLDzEb1w9dJWDilISnn03Bzjfbyy5oSuK0Q1E= github.com/mattn/go-isatty v0.0.0-20171107050531-6ca4dbf54d38/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.0-20180408055351-ce7b0b5c7b45 h1:gEaKFUUdIzJu+JNbGluisX5K1E8MGfe7vkoqR2KH5Mk= github.com/mattn/go-runewidth v0.0.0-20180408055351-ce7b0b5c7b45/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0= +github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI= +github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= +github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84 h1:fiKJgB4JDUd43CApkmCeTSQlWjtTtABrU2qsgbuP0BI= github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +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.5.0 h1:5BakdOZdtKJ1FFk6QdL8iSGrMWsXgchNJcrnarjbmJQ= github.com/pelletier/go-toml v1.5.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= @@ -92,6 +105,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/preichenberger/go-coinbasepro/v2 v2.0.4 h1:9A9hFh+uz6wuO8yBaSKsyIpvmUBEOP2i540eG4nudPo= github.com/preichenberger/go-coinbasepro/v2 v2.0.4/go.mod h1:tsiN/OFQ5FiE+T2i3r88GHDVvR/Jxkx+CGKw7JSYLrE= +github.com/preichenberger/go-coinbasepro/v2 v2.0.5 h1:Mf1k3vZTuLzuzcmCJBIbT8eiRD+N2uEG2C6Ug3upXiA= +github.com/preichenberger/go-coinbasepro/v2 v2.0.5/go.mod h1:tsiN/OFQ5FiE+T2i3r88GHDVvR/Jxkx+CGKw7JSYLrE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -105,25 +120,30 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.6.1 h1:VPZzIkznI1YhVMRi6vNFLHSwhnhReBfgTxIPccpfdZk= github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= +github.com/spf13/viper v1.6.2 h1:7aKfF+e8/k68gda3LOjo5RxiUqddoFxVq4BKBPrxk5E= +github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -161,9 +181,12 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191018095205-727590c5006e h1:ZtoklVMHQy6BFRHkbG6JzK+S6rX82//Yeok1vMlizfQ= golang.org/x/sys v0.0.0-20191018095205-727590c5006e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= diff --git a/http/http.go b/http/http.go index 1870d5c..61ac242 100644 --- a/http/http.go +++ b/http/http.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/viper" - _ "github.com/polyrabbit/token-ticker/config" // config should be initialized first + _ "github.com/polyrabbit/my-token/config" // config should be initialized first "github.com/sirupsen/logrus" ) @@ -63,7 +63,7 @@ func Get(rawURL string, params map[string]string) ([]byte, error) { if err != nil { return nil, err } - req.Header.Set("User-Agent", "Mozilla/5.0 (compatible; token-ticker; +https://github.com/polyrabbit/token-ticker)") + req.Header.Set("User-Agent", "Mozilla/5.0 (compatible; my-token; +https://github.com/polyrabbit/my-token)") req.Header.Set("Cache-Control", "no-cache") req.Header.Add("Cache-Control", "no-store") req.Header.Add("Cache-Control", "must-revalidate") diff --git a/install.sh b/install.sh index ab4462f..c24de02 100644 --- a/install.sh +++ b/install.sh @@ -6,13 +6,13 @@ set -e usage() { this=$1 cat <