1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package main
- import (
- "flag"
- "fmt"
- "net"
- "net/http"
- "os"
- "git.giaever.org/joachimmg/go-log.git/log"
- "git.giaever.org/joachimmg/m-dns/host"
- "git.giaever.org/joachimmg/m-dns/server"
- "git.giaever.org/joachimmg/m-dns/zone"
- )
- func init() {
- flag.Parse()
- }
- func main() {
- hostname, err := os.Hostname()
- if err != nil {
- log.Errorln(err)
- }
- txt := []string{
- "login=true",
- "admin=/admin",
- "autosign=",
- }
- host, err := host.New(
- "This is _a_ .dotted. instance",
- "_myservice._tcp",
- "local",
- hostname,
- []net.IP{net.ParseIP("192.168.1.128")},
- 8080,
- txt,
- )
- if err != nil {
- log.Errorln(err)
- }
- zone, err := zone.New(host)
- if err != nil {
- log.Errorln(err)
- }
- mdnss, err := server.New(zone, nil)
- if err != nil {
- log.Errorln(err)
- }
- log.Traceln(mdnss)
- //mdnss.Daemon()
- http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintf(w, "Hello, I'm just here hangig around.")
- })
- log.Panicln(http.ListenAndServe(":8080", nil))
- }
|