// HopData attempts to extract a set of forwarding instructions from the target
// HopPayload. If the realm isn't what we expect, then an error is returned.
// This method also returns the left over EOB that remain after the hop data
// has been parsed. Callers may want to map this blob into something more
// concrete.
HopData attempts to extract a set of forwarding instructions from the target
HopPayload. If the realm isn't what we expect, then an error is returned.
This method also returns the left over EOB that remain after the hop data
has been parsed. Callers may want to map this blob into something more
concrete.
// HopData attempts to extract a set of forwarding instructions from the target // HopPayload . If the realm isn ' t what we expect then an error is returned . // This method also returns the left over EOB that remain after the hop data // has been parsed . Callers may want to map this blob into something more // concrete .
func (hp *HopPayload) HopData() (*HopData, error) {
	payloadReader := bytes.NewBuffer(hp.Payload)
	if hp.Type != PayloadLegacy {
		return nil, nil
	}
	var hd HopData
	if err := hd.Decode(payloadReader); err != nil {
		return nil, err
	}
	return &hd, nil
}
func ( hp * HopPayload ) HopData ( ) ( * HopData , error ) { payloadReader := bytes . NewBuffer ( hp . Payload ) if hp . Type != PayloadLegacy { return nil , nil } var hd HopData if err := hd . Decode ( payloadReader ) ; err != nil { return nil , err } return & hd , nil }
HopData attempts to extract a set of forwarding instructions from the target
HopPayload.
HopData attempts to extract a set of forwarding instructions from the target HopPayload .
// If this isn't the "base" realm, then we can't extract the expected // hop payload structure from the payload. // Now that we know the payload has the structure we expect, we'll // decode the payload into the HopData.