go-gtp
go-gtp copied to clipboard
add an example of marshalling using reflect
trafficstars
add MarshalTo() and MarshalLen() for GTPv2 echo request using reflect package
reflection can be used in order to define Marshal functions once for all. here is an example with GTPv2 echo request message. Message interface may be used to apply this to all messages types.
I'm generally not in favor of using reflection in the packet processing, as there may be a concern in performance. Could you add some benchmarks to show the difference?
I just added benchmarks for GTPv2 echo request and create session request. Marshalling using reflect is two to four times slowler than current Marshalling.