Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PROTOCOL_ERROR #199

Merged
merged 2 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@ name: Go

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: ^1.16
id: go

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Install dependencies
run: go get -v -t $(go list ./... | grep -v /examples)
- name: Install dependencies
run: go get -v -t $(go list ./... | grep -v /examples)

- name: Test
run: go test -v -cover $(go list ./... | grep -v /examples)
- name: Test
run: go test -v -cover $(go list ./... | grep -v /examples)
33 changes: 21 additions & 12 deletions config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gsclient

import (
"crypto/tls"
"net/http"
"os"
"runtime"
Expand Down Expand Up @@ -60,12 +61,16 @@ func NewConfiguration(apiURL string, uuid string, token string, debugMode, sync
}

cfg := &Config{
apiURL: apiURL,
userUUID: uuid,
apiToken: token,
userAgent: "gsclient-go/" + version + " (" + runtime.GOOS + ")",
sync: sync,
httpClient: http.DefaultClient,
apiURL: apiURL,
userUUID: uuid,
apiToken: token,
userAgent: "gsclient-go/" + version + " (" + runtime.GOOS + ")",
sync: sync,
httpClient: &http.Client{
Transport: &http.Transport{
TLSNextProto: make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
},
},
delayInterval: time.Duration(delayIntervalMilliSecs) * time.Millisecond,
maxNumberOfRetries: maxNumberOfRetries,
}
Expand All @@ -75,12 +80,16 @@ func NewConfiguration(apiURL string, uuid string, token string, debugMode, sync
// DefaultConfiguration creates a default configuration.
func DefaultConfiguration(uuid string, token string) *Config {
cfg := &Config{
apiURL: defaultAPIURL,
userUUID: uuid,
apiToken: token,
userAgent: "gsclient-go/" + version + " (" + runtime.GOOS + ")",
sync: true,
httpClient: http.DefaultClient,
apiURL: defaultAPIURL,
userUUID: uuid,
apiToken: token,
userAgent: "gsclient-go/" + version + " (" + runtime.GOOS + ")",
sync: true,
httpClient: &http.Client{
Transport: &http.Transport{
TLSNextProto: make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
},
},
delayInterval: time.Duration(defaultDelayIntervalMilliSecs) * time.Millisecond,
maxNumberOfRetries: defaultMaxNumberOfRetries,
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gridscale/gsclient-go/v3

go 1.13
go 1.16

require (
github.com/google/uuid v1.2.0
Expand Down
4 changes: 4 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# github.com/davecgh/go-spew v1.1.1
github.com/davecgh/go-spew/spew
# github.com/google/uuid v1.2.0
## explicit
github.com/google/uuid
# github.com/pmezard/go-difflib v1.0.0
github.com/pmezard/go-difflib/difflib
# github.com/sirupsen/logrus v1.7.0
## explicit
github.com/sirupsen/logrus
# github.com/stretchr/testify v1.7.0
## explicit
github.com/stretchr/testify/assert
# golang.org/x/net v0.0.0-20210119194325-5f4716e94777
## explicit
golang.org/x/net/context
# golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
golang.org/x/sys/internal/unsafeheader
Expand Down