Merge branch 'master' of github.com:huin/goupnp
This commit is contained in:
		@@ -412,7 +412,7 @@ func unmarshalXmlFile(file *zip.File, data interface{}) error {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	decoder := xml.NewDecoder(r)
 | 
			
		||||
	r.Close()
 | 
			
		||||
	defer r.Close()
 | 
			
		||||
	return decoder.Decode(data)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package httpu
 | 
			
		||||
import (
 | 
			
		||||
	"bufio"
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"log"
 | 
			
		||||
	"net"
 | 
			
		||||
@@ -28,6 +29,20 @@ func NewHTTPUClient() (*HTTPUClient, error) {
 | 
			
		||||
	return &HTTPUClient{conn: conn}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewHTTPUClientAddr creates a new HTTPUClient which will broadcast packets
 | 
			
		||||
// from the specified address, opening up a new UDP socket for the purpose
 | 
			
		||||
func NewHTTPUClientAddr(addr string) (*HTTPUClient, error) {
 | 
			
		||||
	ip := net.ParseIP(addr)
 | 
			
		||||
	if ip == nil {
 | 
			
		||||
		return nil, errors.New("Invalid listening address")
 | 
			
		||||
	}
 | 
			
		||||
	conn, err := net.ListenPacket("udp", ip.String()+":0")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return &HTTPUClient{conn: conn}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Close shuts down the client. The client will no longer be useful following
 | 
			
		||||
// this.
 | 
			
		||||
func (httpu *HTTPUClient) Close() error {
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ const (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	maxAgeRx = regexp.MustCompile("max-age=([0-9]+)")
 | 
			
		||||
	maxAgeRx = regexp.MustCompile("max-age= *([0-9]+)")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user