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

add timestamps to connection state change events #14

Merged
merged 1 commit into from
Dec 7, 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
5 changes: 5 additions & 0 deletions api/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/cenkalti/backoff/v4"
"google.golang.org/protobuf/types/known/timestamppb"

pb "github.com/pomerium/cli/proto"
"github.com/pomerium/cli/tcptunnel"
Expand Down Expand Up @@ -150,6 +151,7 @@ func (evt *tunnelEvents) OnConnecting(ctx context.Context) {
Id: evt.id,
PeerAddr: evt.peer,
Status: pb.ConnectionStatusUpdate_CONNECTION_STATUS_CONNECTING,
Ts: timestamppb.Now(),
})
}

Expand All @@ -160,6 +162,7 @@ func (evt *tunnelEvents) OnConnected(ctx context.Context) {
Id: evt.id,
PeerAddr: evt.peer,
Status: pb.ConnectionStatusUpdate_CONNECTION_STATUS_CONNECTED,
Ts: timestamppb.Now(),
})
}

Expand All @@ -171,6 +174,7 @@ func (evt *tunnelEvents) OnAuthRequired(ctx context.Context, u string) {
PeerAddr: evt.peer,
Status: pb.ConnectionStatusUpdate_CONNECTION_STATUS_AUTH_REQUIRED,
AuthUrl: &u,
Ts: timestamppb.Now(),
})
}

Expand All @@ -180,6 +184,7 @@ func (evt *tunnelEvents) OnDisconnected(ctx context.Context, err error) {
Id: evt.id,
PeerAddr: evt.peer,
Status: pb.ConnectionStatusUpdate_CONNECTION_STATUS_DISCONNECTED,
Ts: timestamppb.Now(),
}
if err != nil {
txt := err.Error()
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,12 @@ github.com/caddyserver/certmagic v0.14.1/go.mod h1:oRQOZmUVKwlpgNidslysHt05osM9u
github.com/caddyserver/certmagic v0.15.1 h1:OAS245AZWQ1n2BD2gSBJPnKu3COTi2HNKj/6Td8aUQg=
github.com/caddyserver/certmagic v0.15.1/go.mod h1:/0VQ5og2Jxa5yBQ8eT80wWS7fi/DgNy1uXeXRUJ1Wj0=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo=
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
Expand Down
Loading