package handler import ( "net/http" "nymdrop/internal/relay" ) type Submit struct { relay *relay.Relay } func NewSubmit(r *relay.Relay) *Submit { return &Submit{relay: r} } func (s *Submit) ServeHTTP(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { http.Error(w, "method not allowed", http.StatusMethodNotAllowed) return } r.Body = http.MaxBytesReader(w, r.Body, 10*1024*1024) defer r.Body.Close() if err := s.relay.Forward(r.Body); err != nil { // Generic error — reveal nothing about internals. http.Error(w, "error", http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) w.Write([]byte("ok")) }