diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-16 10:06:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-16 12:23:18 +0900 |
commit | c1bca2555919f9f2a7dd9d13dc3e14a4bf6a589a (patch) | |
tree | 3a19cc12f27f146df079e03a487acea492e8d595 /pkg/server/grpc_server.go | |
parent | 893dbd5c074c097f0c9921d3131a072011fb7e6a (diff) |
use google/protobuf/timestamp.proto
use google/protobuf/timestamp.proto instead of our own way to
represent time.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'pkg/server/grpc_server.go')
-rw-r--r-- | pkg/server/grpc_server.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go index 98b28b00..54d4b28d 100644 --- a/pkg/server/grpc_server.go +++ b/pkg/server/grpc_server.go @@ -28,6 +28,7 @@ import ( "time" farm "github.com/dgryski/go-farm" + "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/any" "github.com/golang/protobuf/ptypes/empty" log "github.com/sirupsen/logrus" @@ -115,10 +116,11 @@ func newValidationFromTableStruct(v *table.Validation) *api.RPKIValidation { func toPathAPI(binNlri []byte, binPattrs [][]byte, anyNlri *any.Any, anyPattrs []*any.Any, path *table.Path, v *table.Validation) *api.Path { nlri := path.GetNlri() + t, _ := ptypes.TimestampProto(path.GetTimestamp()) p := &api.Path{ Nlri: binNlri, Pattrs: binPattrs, - Age: path.GetTimestamp().Unix(), + Age: t, IsWithdraw: path.IsWithdraw, ValidationDetail: newValidationFromTableStruct(v), Family: &api.Family{Afi: api.Family_Afi(nlri.AFI()), Safi: api.Family_Safi(nlri.SAFI())}, @@ -615,8 +617,6 @@ func newNeighborFromAPIStruct(a *api.Peer) (*config.Neighbor, error) { if a.Timers.State != nil { pconf.Timers.State.KeepaliveInterval = float64(a.Timers.State.KeepaliveInterval) pconf.Timers.State.NegotiatedHoldTime = float64(a.Timers.State.NegotiatedHoldTime) - pconf.Timers.State.Uptime = int64(a.Timers.State.Uptime) - pconf.Timers.State.Downtime = int64(a.Timers.State.Downtime) } } if a.RouteReflector != nil { @@ -723,8 +723,6 @@ func newPeerGroupFromAPIStruct(a *api.PeerGroup) (*config.PeerGroup, error) { if a.Timers.State != nil { pconf.Timers.State.KeepaliveInterval = float64(a.Timers.State.KeepaliveInterval) pconf.Timers.State.NegotiatedHoldTime = float64(a.Timers.State.NegotiatedHoldTime) - pconf.Timers.State.Uptime = int64(a.Timers.State.Uptime) - pconf.Timers.State.Downtime = int64(a.Timers.State.Downtime) } } if a.RouteReflector != nil { |