code: func (s *TrapServer) handle(listener TrapListener, conn interface{}, msg message, src net.Addr, err error) {
  	defer func() {
  		if err := recover(); err != nil {
  			const size = 64 << 10
  			logBuf := make([]byte, size)
  			logBuf = logBuf[:runtime.Stack(logBuf, false)]
  			s.logf("trap: panic while receiving %v: %v\n%s", src, err, logBuf)
  
  		}
  	}()
  
  	var pdu Pdu
  	var mp messageProcessing
  	var sec security
  	if msg != nil {
  		var ok bool
  		v := msg.Version()
  		if mp, ok = s.mps[v]; ok {
  			if sec = s.secs[v].Lookup(msg); sec != nil {
  				pdu, err = mp.PrepareDataElements(sec, msg, nil)
  			} else {
  				err = &MessageError{
  					Message: "Authentication failure",
  					Detail:  fmt.Sprintf("Message - [%s]", msg),
  				}
  			}
  		} else {
  			err = &MessageError{
  				Message: fmt.Sprintf("Unsupported SNMP version: %s", v),
  				Detail:  fmt.Sprintf("Message - [%s]", msg),
  			}
  		}
  	}
  
  	if pdu != nil {
  		switch t := pdu.PduType(); t {
  		case SNMPTrapV2, InformRequest:
  		default:
  			err = &MessageError{
  				Message: fmt.Sprintf("Invalid PduType: %s ", t),
  				Detail:  fmt.Sprintf("Message - [%s]", msg),
  			}
  			pdu = nil
  		}
  	}
  
  	listener.OnTRAP(&TrapRequest{Pdu: pdu, Source: src, Error: err})
  
  	if pdu != nil && pdu.PduType() == InformRequest {
  		if err = s.informResponse(conn, src, mp, sec, msg); err != nil && s.serving {
  			s.logf("trap: failed to send response %v: %v", src, err)
  		}
  	}
  }
docs: // handle a newly received trap