diff options
Diffstat (limited to 'packet/bgp/bgp.go')
-rw-r--r-- | packet/bgp/bgp.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go index 2de2af63..8bfea717 100644 --- a/packet/bgp/bgp.go +++ b/packet/bgp/bgp.go @@ -6785,3 +6785,23 @@ func (msg *BGPMessage) Serialize() ([]byte, error) { } return append(h, b...), nil } + +type MessageError struct { + TypeCode uint8 + SubTypeCode uint8 + Data []byte + Message string +} + +func NewMessageError(typeCode, subTypeCode uint8, data []byte, msg string) error { + return &MessageError{ + TypeCode: typeCode, + SubTypeCode: subTypeCode, + Data: data, + Message: msg, + } +} + +func (e *MessageError) Error() string { + return e.Message +} |