File: listen_no_socket_options.go

package info (click to toggle)
golang-github-miekg-dns 1.1.68-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 1,260 kB
  • sloc: makefile: 3
file content (40 lines) | stat: -rw-r--r-- 921 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd

package dns

import (
	"fmt"
	"net"
)

const (
	supportsReusePort = false
	supportsReuseAddr = false
)

func listenTCP(network, addr string, reuseport, reuseaddr bool) (net.Listener, error) {
	if reuseport || reuseaddr {
		// TODO(tmthrgd): return an error?
	}

	return net.Listen(network, addr)
}

func listenUDP(network, addr string, reuseport, reuseaddr bool) (net.PacketConn, error) {
	if reuseport || reuseaddr {
		// TODO(tmthrgd): return an error?
	}

	return net.ListenPacket(network, addr)
}

// this is just for test compatibility
func checkReuseport(fd uintptr) (bool, error) {
	return false, fmt.Errorf("not supported")
}

// this is just for test compatibility
func checkReuseaddr(fd uintptr) (bool, error) {
	return false, fmt.Errorf("not supported")
}