diff options
-rw-r--r-- | table/destination.go | 5 | ||||
-rw-r--r-- | table/path.go | 5 | ||||
-rw-r--r-- | table/table.go | 5 |
3 files changed, 6 insertions, 9 deletions
diff --git a/table/destination.go b/table/destination.go index f90a53fa..f99af8ef 100644 --- a/table/destination.go +++ b/table/destination.go @@ -95,13 +95,12 @@ func NewDestinationDefault(nlri bgp.AddrPrefixInterface) *DestinationDefault { func (dd *DestinationDefault) MarshalJSON() ([]byte, error) { prefix := dd.getNlri().(*bgp.NLRInfo).Prefix - paths, _ := json.Marshal(dd.knownPathList) return json.Marshal(struct { Prefix string - Paths string + Paths []Path }{ Prefix: prefix.String(), - Paths: string(paths), + Paths: dd.knownPathList, }) } diff --git a/table/path.go b/table/path.go index 9b38bc44..635cbf5d 100644 --- a/table/path.go +++ b/table/path.go @@ -97,7 +97,6 @@ func (pd *PathDefault) MarshalJSON() ([]byte, error) { aslist = append(aslist, path.AS...) } } - asPath, _ := json.Marshal(aslist) var prefix net.IP var prefixLen uint8 @@ -110,7 +109,7 @@ func (pd *PathDefault) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Network string Nexthop string - AsPath string + AsPath []uint32 Metric string //origin string Best string @@ -118,7 +117,7 @@ func (pd *PathDefault) MarshalJSON() ([]byte, error) { Network: prefix.String() + "/" + fmt.Sprint(prefixLen), Nexthop: pd.nexthop.String(), Metric: fmt.Sprint(med), - AsPath: string(asPath), + AsPath: aslist, Best: fmt.Sprint(pd.isBest), }) } diff --git a/table/table.go b/table/table.go index df55947b..a9d742aa 100644 --- a/table/table.go +++ b/table/table.go @@ -55,12 +55,11 @@ func (td *TableDefault) MarshalJSON() ([]byte, error) { for _, dest := range td.destinations { destList = append(destList, dest) } - j, _ := json.Marshal(destList) return json.Marshal(struct { - Destinations string + Destinations []Destination }{ - Destinations: string(j), + Destinations: destList, }) } |