Add comprehensive godoc documentation to handler.go

Expand documentation comments for SimpleHandler type and its methods
to better explain their purpose, parameters, and behavior.
This commit is contained in:
2025-12-27 12:24:36 +07:00
parent e1d0ab5ea6
commit c292fef0ac
7 changed files with 52 additions and 19 deletions

View File

@@ -11,7 +11,9 @@ import (
// flattening any nested structures into a single sequence of AS numbers.
type ASPath []int
// UnmarshalJSON implements custom JSON unmarshaling to flatten nested arrays
// UnmarshalJSON implements the json.Unmarshaler interface for ASPath.
// It handles both simple integer arrays [1, 2, 3] and nested AS sets
// like [1, [2, 3], 4], flattening them into a single slice of integers.
func (p *ASPath) UnmarshalJSON(data []byte) error {
// First try to unmarshal as a simple array of integers
var simple []int
@@ -48,7 +50,9 @@ func (p *ASPath) UnmarshalJSON(data []byte) error {
return nil
}
// RISLiveMessage represents the outer wrapper from the RIS Live stream
// RISLiveMessage represents the outer wrapper message from the RIPE RIS Live stream.
// Each message contains a Type field indicating the message type and a Data field
// containing the actual BGP message payload.
type RISLiveMessage struct {
Type string `json:"type"`
Data RISMessage `json:"data"`