-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/cloexec
- Loading branch information
Showing
6 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
//go:build windows | ||
|
||
package server4 | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"net" | ||
) | ||
|
||
// NewIPv4UDPConn fails on Windows. Use WithConn() to pass the connection. | ||
// NewIPv4UDPConn returns an UDPv4 connection bound to the IP and port provider | ||
func NewIPv4UDPConn(iface string, addr *net.UDPAddr) (*net.UDPConn, error) { | ||
return nil, errors.New("not implemented on Windows") | ||
connection, err := net.ListenPacket("udp4", addr.String()) | ||
if err != nil { | ||
return nil, fmt.Errorf("We cannot listen on %s and port %d: %v", addr.IP, addr.Port, err) | ||
} | ||
udpConn, ok := connection.(*net.UDPConn) | ||
if !ok { | ||
return nil, fmt.Errorf("The connection is not of the proper type") | ||
} | ||
return udpConn, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters