File: example_httpu_serving.go

package info (click to toggle)
golang-github-huin-goupnp 0.0~git20171001.0.b388724-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 680 kB
  • sloc: makefile: 3
file content (20 lines) | stat: -rw-r--r-- 406 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"log"
	"net/http"

	"github.com/huin/goupnp/httpu"
)

func main() {
	srv := httpu.Server{
		Addr:      "239.255.255.250:1900",
		Multicast: true,
		Handler: httpu.HandlerFunc(func(r *http.Request) {
			log.Printf("Got %s %s message from %v: %v", r.Method, r.URL.Path, r.RemoteAddr, r.Header)
		}),
	}
	err := srv.ListenAndServe()
	log.Printf("Serving failed with error: %v", err)
}