blob: 31cab5c07a075782f90f847a49fe02a3bfd11d58 (
plain)
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
41
42
43
44
45
46
|
// +build !linux
package main
import (
"net"
)
/* This code is meant to be a temporary solution
* on platforms for which the sticky socket / source caching behavior
* has not yet been implemented.
*
* See conn_linux.go for an implementation on the linux platform.
*/
type Endpoint *net.UDPAddr
type NativeBind *net.UDPConn
func CreateUDPBind(port uint16) (UDPBind, uint16, error) {
// listen
addr := UDPAddr{
Port: int(port),
}
conn, err := net.ListenUDP("udp", &addr)
if err != nil {
return nil, 0, err
}
// retrieve port
laddr := conn.LocalAddr()
uaddr, _ = net.ResolveUDPAddr(
laddr.Network(),
laddr.String(),
)
return uaddr.Port
}
func (_ Endpoint) ClearSrc() {}
func SetMark(conn *net.UDPConn, value uint32) error {
return nil
}
|