Skip to content

Commit

Permalink
Make uuid mandatory (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
crimsonred committed Jan 13, 2022
1 parent 4a246d8 commit ddde187
Show file tree
Hide file tree
Showing 172 changed files with 322 additions and 441 deletions.
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
version: v6.1.0
version: v7.0.0
changelog:
- date: 2022-01-06
version: v7.0.0
changes:
- type: improvement
text: "BREAKING CHANGES: UUID is not automatically generated by the SDK anymore. Please set it in the PNConfig before instantiating the PubNub object. If UUID is empty panic will occur."
- date: 2021-12-16
version: v6.1.0
changes:
Expand Down Expand Up @@ -689,9 +694,9 @@ sdks:
distributions:
-
distribution-type: package
distribution-repository: GitHub release
distribution-repository: GitHub
package-name: Go
location: https://github.com/pubnub/go/releases/tag/v6.1.0
location: https://github.com/pubnub/go/releases/tag/v7.0.0
requires:
-
name: "Go"
Expand Down
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go_import_path: github.com/pubnub/go/v6
go_import_path: github.com/pubnub/go/v7
dist: xenial
language: go
os: linux
Expand All @@ -20,16 +20,16 @@ stages:
jobs:
include:
- stage: "test"
name: 'Go 1.14.6'
go: 1.14.6
name: 'Go 1.15.15'
go: 1.15.15
script:
- bash ./scripts/run-tests.sh -mod=mod
- name: 'Go 1.15.12'
go: 1.15.12
- name: 'Go 1.16.12'
go: 1.16.12
script:
- bash ./scripts/run-tests.sh -mod=mod
- name: 'Go 1.16.4'
go: 1.16.4
- name: 'Go 1.17.5'
go: 1.17.5
script:
- bash ./scripts/run-tests.sh -mod=mod
- name: 'Go "master"'
Expand All @@ -41,7 +41,7 @@ jobs:
script: bash ./scripts/run-tests.sh -mod=mod
- stage: "code coverage"
name: 'Test & Code coverage'
go: 1.16.4
go: 1.17.5
script: bash ./scripts/run-tests.sh -mod=mod
after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v7.0.0
January 06 2022

#### Modified
- BREAKING CHANGES: UUID is not automatically generated by the SDK anymore. Please set it in the PNConfig before instantiating the PubNub object. If UUID is empty panic will occur.

## v6.1.0
December 16 2021

Expand Down
2 changes: 1 addition & 1 deletion add_channel_channel_group_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/url"
"strings"

"github.com/pubnub/go/v6/utils"
"github.com/pubnub/go/v7/utils"
)

const addChannelToChannelGroupPath = "/v1/channel-registration/sub-key/%s/channel-group/%s"
Expand Down
2 changes: 1 addition & 1 deletion add_channel_channel_group_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/url"
"testing"

h "github.com/pubnub/go/v6/tests/helpers"
h "github.com/pubnub/go/v7/tests/helpers"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion add_channels_to_push_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/url"
"strings"

"github.com/pubnub/go/v6/utils"
"github.com/pubnub/go/v7/utils"
)

const addChannelsToPushPath = "/v1/push/sub-key/%s/devices/%s"
Expand Down
11 changes: 4 additions & 7 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"log"
"sync"

"github.com/pubnub/go/v6/utils"
)

const (
Expand All @@ -22,7 +20,7 @@ type Config struct {
SecretKey string // SecretKey (only required for modifying/revealing access permissions).
AuthKey string // AuthKey If Access Manager is utilized, client will use this AuthKey in all restricted requests.
Origin string // Custom Origin if needed
UUID string // UUID to be used as a device identifier, a default uuid is generated if not passed.
UUID string // UUID to be used as a device identifier.
CipherKey string // If CipherKey is passed, all communications to/from PubNub will be encrypted.
Secure bool // True to use TLS
ConnectTimeout int // net.Dialer.Timeout
Expand Down Expand Up @@ -50,7 +48,7 @@ type Config struct {

// NewDemoConfig initiates the config with demo keys, for tests only.
func NewDemoConfig() *Config {
demoConfig := NewConfig()
demoConfig := NewConfig(GenerateUUID())

demoConfig.PublishKey = "demo"
demoConfig.SubscribeKey = "demo"
Expand All @@ -61,8 +59,9 @@ func NewDemoConfig() *Config {
}

// NewConfig initiates the config with default values.
func NewConfig() *Config {
func NewConfig(uuid string) *Config {
c := Config{
UUID: uuid,
Origin: "ps.pndsn.com",
Secure: true,
ConnectTimeout: 10,
Expand All @@ -83,8 +82,6 @@ func NewConfig() *Config {
UseRandomInitializationVector: true,
}

c.UUID = fmt.Sprintf("pn-%s", utils.UUID())

return &c
}

Expand Down
2 changes: 1 addition & 1 deletion delete_channel_group_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"net/url"

"github.com/pubnub/go/v6/utils"
"github.com/pubnub/go/v7/utils"
)

const deleteChannelGroupPath = "/v1/channel-registration/sub-key/%s/channel-group/%s/remove"
Expand Down
2 changes: 1 addition & 1 deletion delete_channel_group_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/url"
"testing"

h "github.com/pubnub/go/v6/tests/helpers"
h "github.com/pubnub/go/v7/tests/helpers"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 3 additions & 3 deletions endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"strings"
"time"

"github.com/pubnub/go/v6/pnerr"
"github.com/pubnub/go/v6/utils"
"github.com/pubnub/go/v7/pnerr"
"github.com/pubnub/go/v7/utils"
)

type endpointOpts interface {
Expand Down Expand Up @@ -72,7 +72,7 @@ func defaultQuery(uuid string, telemetryManager *TelemetryManager) *url.Values {
v := &url.Values{}

v.Set("pnsdk", "PubNub-Go/"+Version)

utils.CheckUUID(uuid)
v.Set("uuid", uuid)

for queryName, queryParam := range telemetryManager.OperationLatency() {
Expand Down
Loading

0 comments on commit ddde187

Please sign in to comment.