diff --git a/Gopkg.lock b/Gopkg.lock index cdf1f12..b2b2ca0 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -3,9 +3,9 @@ [[projects]] name = "github.com/CyCoreSystems/ari" - packages = [".","client/arimocks","client/native","ext/play","stdbus"] - revision = "93f80598879bfbcd1ebb4087988b61f6fcdc6f55" - version = "v4.6.1" + packages = [".","client/arimocks","client/native","ext/play","rid","stdbus"] + revision = "902b7bccacb25a5ee78ba8bd51bfa03b25386dc3" + version = "v4.7.0" [[projects]] name = "github.com/davecgh/go-spew" @@ -89,6 +89,12 @@ packages = ["."] revision = "3cf34f9fca4e88afa9da8eabd75e3326c9941b44" +[[projects]] + name = "github.com/oklog/ulid" + packages = ["."] + revision = "d311cb43c92434ec4072dfbbda3400741d0a6337" + version = "v0.3.0" + [[projects]] name = "github.com/pelletier/go-toml" packages = ["."] @@ -106,12 +112,6 @@ revision = "792786c7400a136282c1664665ae0a8db921c6c2" version = "v1.0.0" -[[projects]] - name = "github.com/satori/go.uuid" - packages = ["."] - revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3" - version = "v1.2.0" - [[projects]] name = "github.com/spf13/afero" packages = [".","mem"] @@ -161,7 +161,7 @@ [[projects]] branch = "master" name = "golang.org/x/net" - packages = ["context","websocket"] + packages = ["websocket"] revision = "6078986fec03a1dcc236c34816c71b0e05018fda" [[projects]] @@ -183,6 +183,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "8ef0f3b6a3ac41d349733acda73dbb8f8fc480e78c12428e20b84d618c88cc66" + inputs-digest = "d223b2aba0e8f37688d7857edbb4b6ca7e1dd45d6f13dc4341e6dbbbc8c7661c" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 61a46b9..b1e21b0 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,6 +1,6 @@ [[constraint]] name = "github.com/CyCoreSystems/ari" - version = "4.6.1" + version = "4.7.0" [[constraint]] name = "github.com/inconshreveable/log15" @@ -14,10 +14,6 @@ name = "github.com/pkg/errors" version = "0.8.0" -[[constraint]] - name = "github.com/satori/go.uuid" - version = "1.2.0" - [[constraint]] name = "github.com/spf13/cobra" version = "0.0.2" diff --git a/Makefile b/Makefile index c237ef3..8ab08a4 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ test: go test ./... lint: - gometalinter --skip internal --vendor ./... + gometalinter --skip internal --vendor --deadline=60s ./... check: all lint test diff --git a/_examples/bridge/main.go b/_examples/bridge/main.go index 7f408c6..03406b2 100644 --- a/_examples/bridge/main.go +++ b/_examples/bridge/main.go @@ -10,8 +10,8 @@ import ( "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/client" "github.com/CyCoreSystems/ari/ext/play" + "github.com/CyCoreSystems/ari/rid" "github.com/pkg/errors" - uuid "github.com/satori/go.uuid" ) var ariApp = "test" @@ -79,7 +79,7 @@ func ensureBridge(ctx context.Context, cl ari.Client, src *ari.Key) (err error) return nil } - key := src.New(ari.BridgeKey, uuid.NewV1().String()) + key := src.New(ari.BridgeKey, rid.New(rid.Bridge)) bridge, err = cl.Bridge().Create(key, "mixing", key.ID) if err != nil { bridge = nil diff --git a/client/bridge.go b/client/bridge.go index 1dce9c3..5b8c91d 100644 --- a/client/bridge.go +++ b/client/bridge.go @@ -3,7 +3,7 @@ package client import ( "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" - uuid "github.com/satori/go.uuid" + "github.com/CyCoreSystems/ari/rid" ) type bridge struct { @@ -139,7 +139,7 @@ func (b *bridge) Record(key *ari.Key, name string, opts *ari.RecordingOptions) ( opts = &ari.RecordingOptions{} } if name == "" { - name = uuid.NewV1().String() + name = rid.New(rid.Recording) } k, err := b.c.createRequest(&proxy.Request{ @@ -161,7 +161,7 @@ func (b *bridge) StageRecord(key *ari.Key, name string, opts *ari.RecordingOptio opts = &ari.RecordingOptions{} } if name == "" { - name = uuid.NewV1().String() + name = rid.New(rid.Recording) } k, err := b.c.getRequest(&proxy.Request{ diff --git a/client/channel.go b/client/channel.go index 55b37ae..82f60a7 100644 --- a/client/channel.go +++ b/client/channel.go @@ -5,7 +5,7 @@ import ( "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" - uuid "github.com/satori/go.uuid" + "github.com/CyCoreSystems/ari/rid" ) type channel struct { @@ -47,7 +47,7 @@ func (c *channel) Originate(key *ari.Key, o ari.OriginateRequest) (*ari.ChannelH func (c *channel) StageOriginate(key *ari.Key, o ari.OriginateRequest) (*ari.ChannelHandle, error) { if o.ChannelID == "" { - o.ChannelID = uuid.NewV1().String() + o.ChannelID = rid.New(rid.Channel) } k, err := c.c.createRequest(&proxy.Request{ @@ -290,7 +290,7 @@ func (c *channel) Play(key *ari.Key, playbackID string, mediaURI string) (*ari.P func (c *channel) StagePlay(key *ari.Key, playbackID string, mediaURI string) (*ari.PlaybackHandle, error) { if playbackID == "" { - playbackID = uuid.NewV1().String() + playbackID = rid.New(rid.Playback) } k, err := c.c.getRequest(&proxy.Request{ diff --git a/client/client.go b/client/client.go index b6e0728..548686f 100644 --- a/client/client.go +++ b/client/client.go @@ -9,11 +9,11 @@ import ( "github.com/CyCoreSystems/ari-proxy/client/bus" "github.com/CyCoreSystems/ari-proxy/client/cluster" "github.com/CyCoreSystems/ari-proxy/proxy" + "github.com/CyCoreSystems/ari/rid" "github.com/inconshreveable/log15" "github.com/nats-io/nats" "github.com/pkg/errors" - uuid "github.com/satori/go.uuid" ) // ClosureGracePeriod is the amount of time to wait after the closure of the @@ -523,7 +523,7 @@ func (c *Client) makeRequests(class string, req *proxy.Request) (responses []*pr var responseCount int expected := len(c.core.cluster.Matching(req.Key.Node, req.Key.App, c.core.clusterMaxAge)) - reply := uuid.NewV1().String() + reply := rid.New("rp") replyChan := make(chan *proxy.Response) replySub, err := c.core.nc.Subscribe(reply, func(o *proxy.Response) { responseCount++ @@ -570,7 +570,7 @@ func (c *Client) makeBroadcastRequestReturnFirstGoodResponse(class string, req * } expected := len(c.core.cluster.Matching(req.Key.Node, req.Key.App, c.core.clusterMaxAge)) - reply := uuid.NewV1().String() + reply := rid.New("rp") replyChan := make(chan *proxy.Response) var responseCount int diff --git a/client/clientserver_test.go b/client/clientserver_test.go index ac2bbce..8452959 100644 --- a/client/clientserver_test.go +++ b/client/clientserver_test.go @@ -8,8 +8,8 @@ import ( "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/server" + "github.com/CyCoreSystems/ari/rid" "github.com/nats-io/nats" - uuid "github.com/satori/go.uuid" ) type srv struct { @@ -20,7 +20,7 @@ func (s *srv) Start(ctx context.Context, t *testing.T, mockClient ari.Client, nc s.s = server.New() // tests may run in parallel so we don't want two separate proxy servers to conflict. - s.s.NATSPrefix = uuid.NewV1().String() + "." + s.s.NATSPrefix = rid.New("") + "." go func() { if err := s.s.ListenOn(ctx, mockClient, nc); err != nil { diff --git a/client/cluster/cluster_test.go b/client/cluster/cluster_test.go index 28d7702..95986ae 100644 --- a/client/cluster/cluster_test.go +++ b/client/cluster/cluster_test.go @@ -5,12 +5,12 @@ import ( "testing" "time" - uuid "github.com/satori/go.uuid" + "github.com/CyCoreSystems/ari/rid" ) func TestHash(t *testing.T) { - id := uuid.NewV1().String() - app := uuid.NewV1().String() + id := rid.New("") + app := rid.New("") testID, testApp := dehash(hash(id, app)) if id != testID { diff --git a/server/bridge.go b/server/bridge.go index a0e9573..fadbdfe 100644 --- a/server/bridge.go +++ b/server/bridge.go @@ -5,7 +5,7 @@ import ( "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" - uuid "github.com/satori/go.uuid" + "github.com/CyCoreSystems/ari/rid" ) func (s *Server) bridgeAddChannel(ctx context.Context, reply string, req *proxy.Request) { @@ -140,7 +140,7 @@ func (s *Server) bridgeStagePlay(ctx context.Context, reply string, req *proxy.R } if req.BridgePlay.PlaybackID == "" { - req.BridgePlay.PlaybackID = uuid.NewV1().String() + req.BridgePlay.PlaybackID = rid.New(rid.Playback) } // bind dialog @@ -162,7 +162,7 @@ func (s *Server) bridgeRecord(ctx context.Context, reply string, req *proxy.Requ } if req.BridgeRecord.Name == "" { - req.BridgeRecord.Name = uuid.NewV1().String() + req.BridgeRecord.Name = rid.New(rid.Recording) } // bind dialog @@ -190,7 +190,7 @@ func (s *Server) bridgeStageRecord(ctx context.Context, reply string, req *proxy } if req.BridgeRecord.Name == "" { - req.BridgeRecord.Name = uuid.NewV1().String() + req.BridgeRecord.Name = rid.New(rid.Recording) } if req.Key.Dialog != "" { diff --git a/server/channel.go b/server/channel.go index 77c6642..22bda69 100644 --- a/server/channel.go +++ b/server/channel.go @@ -5,7 +5,7 @@ import ( "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/proxy" - uuid "github.com/satori/go.uuid" + "github.com/CyCoreSystems/ari/rid" ) func (s *Server) channelAnswer(ctx context.Context, reply string, req *proxy.Request) { @@ -36,7 +36,7 @@ func (s *Server) channelCreate(ctx context.Context, reply string, req *proxy.Req create := req.ChannelCreate.ChannelCreateRequest if create.ChannelID == "" { - create.ChannelID = uuid.NewV1().String() + create.ChannelID = rid.New(rid.Channel) } // bind dialog @@ -122,7 +122,7 @@ func (s *Server) channelOriginate(ctx context.Context, reply string, req *proxy. orig := req.ChannelOriginate.OriginateRequest if orig.ChannelID == "" { - orig.ChannelID = uuid.NewV1().String() + orig.ChannelID = rid.New(rid.Channel) } if req.Key.Dialog != "" { @@ -146,7 +146,7 @@ func (s *Server) channelStageOriginate(ctx context.Context, reply string, req *p h := s.ari.Channel().Get(req.Key) if req.ChannelOriginate.OriginateRequest.ChannelID == "" { - req.ChannelOriginate.OriginateRequest.ChannelID = uuid.NewV1().String() + req.ChannelOriginate.OriginateRequest.ChannelID = rid.New(rid.Channel) } if req.Key.Dialog != "" { @@ -166,7 +166,7 @@ func (s *Server) channelPlay(ctx context.Context, reply string, req *proxy.Reque } if req.ChannelPlay.PlaybackID == "" { - req.ChannelPlay.PlaybackID = uuid.NewV1().String() + req.ChannelPlay.PlaybackID = rid.New(rid.Playback) } if req.Key.Dialog != "" { @@ -194,7 +194,7 @@ func (s *Server) channelStagePlay(ctx context.Context, reply string, req *proxy. } if req.ChannelPlay.PlaybackID == "" { - req.ChannelPlay.PlaybackID = uuid.NewV1().String() + req.ChannelPlay.PlaybackID = rid.New(rid.Playback) } if req.Key.Dialog != "" { @@ -209,7 +209,7 @@ func (s *Server) channelStagePlay(ctx context.Context, reply string, req *proxy. func (s *Server) channelRecord(ctx context.Context, reply string, req *proxy.Request) { if req.ChannelRecord.Name == "" { - req.ChannelRecord.Name = uuid.NewV1().String() + req.ChannelRecord.Name = rid.New(rid.Recording) } if req.Key.Dialog != "" { @@ -236,7 +236,7 @@ func (s *Server) channelStageRecord(ctx context.Context, reply string, req *prox } if req.ChannelRecord.Name == "" { - req.ChannelRecord.Name = uuid.NewV1().String() + req.ChannelRecord.Name = rid.New(rid.Recording) } if req.Key.Dialog != "" { @@ -263,7 +263,7 @@ func (s *Server) channelSilence(ctx context.Context, reply string, req *proxy.Re func (s *Server) channelSnoop(ctx context.Context, reply string, req *proxy.Request) { if req.ChannelSnoop.SnoopID == "" { - req.ChannelSnoop.SnoopID = uuid.NewV1().String() + req.ChannelSnoop.SnoopID = rid.New(rid.Snoop) } if req.Key.Dialog != "" { @@ -289,7 +289,7 @@ func (s *Server) channelStageSnoop(ctx context.Context, reply string, req *proxy } if req.ChannelSnoop.SnoopID == "" { - req.ChannelSnoop.SnoopID = uuid.NewV1().String() + req.ChannelSnoop.SnoopID = rid.New(rid.Snoop) } if req.Key.Dialog != "" { diff --git a/server/clientserver_test.go b/server/clientserver_test.go index 79b408d..7e22163 100644 --- a/server/clientserver_test.go +++ b/server/clientserver_test.go @@ -9,8 +9,8 @@ import ( "github.com/CyCoreSystems/ari" "github.com/CyCoreSystems/ari-proxy/client" + "github.com/CyCoreSystems/ari/rid" "github.com/nats-io/nats" - uuid "github.com/satori/go.uuid" ) type srv struct { @@ -20,7 +20,7 @@ type srv struct { func (s *srv) Start(ctx context.Context, t *testing.T, mockClient ari.Client, nc *nats.EncodedConn, completeCh chan struct{}) (ari.Client, error) { s.s = New() // tests may run in parallel so we don't want two separate proxy servers to conflict. - s.s.NATSPrefix = uuid.NewV1().String() + "." + s.s.NATSPrefix = rid.New("") + "." s.s.Application = "asdf" go func() {