|
|
@ -143,7 +143,7 @@ func (d *TestIGD) serveUPnPDiscovery() {
|
|
|
|
pkt := buf[:n]
|
|
|
|
pkt := buf[:n]
|
|
|
|
if bytes.Equal(pkt, uPnPPacket) { // a super lazy "parse"
|
|
|
|
if bytes.Equal(pkt, uPnPPacket) { // a super lazy "parse"
|
|
|
|
d.inc(&d.counters.numUPnPDiscoRecv)
|
|
|
|
d.inc(&d.counters.numUPnPDiscoRecv)
|
|
|
|
resPkt := []byte(fmt.Sprintf("HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=120\r\nST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\nUSN: uuid:bee7052b-49e8-3597-b545-55a1e38ac11::urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\nEXT:\r\nSERVER: Tailscale-Test/1.0 UPnP/1.1 MiniUPnPd/2.2.1\r\nLOCATION: %s\r\nOPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n01-NLS: 1627958564\r\nBOOTID.UPNP.ORG: 1627958564\r\nCONFIGID.UPNP.ORG: 1337\r\n\r\n", d.ts.URL+"/rootDesc.xml"))
|
|
|
|
resPkt := fmt.Appendf(nil, "HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=120\r\nST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\nUSN: uuid:bee7052b-49e8-3597-b545-55a1e38ac11::urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\nEXT:\r\nSERVER: Tailscale-Test/1.0 UPnP/1.1 MiniUPnPd/2.2.1\r\nLOCATION: %s\r\nOPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n01-NLS: 1627958564\r\nBOOTID.UPNP.ORG: 1627958564\r\nCONFIGID.UPNP.ORG: 1337\r\n\r\n", d.ts.URL+"/rootDesc.xml")
|
|
|
|
if d.doUPnP {
|
|
|
|
if d.doUPnP {
|
|
|
|
_, err = d.upnpConn.WriteTo(resPkt, src)
|
|
|
|
_, err = d.upnpConn.WriteTo(resPkt, src)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|