github.com/quic-go/quic-go@v0.44.0/sys_conn_windows_test.go (about)

     1  //go:build windows
     2  
     3  package quic
     4  
     5  import (
     6  	"net"
     7  
     8  	. "github.com/onsi/ginkgo/v2"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("Windows Conn Test", func() {
    13  	It("works on IPv4", func() {
    14  		addr, err := net.ResolveUDPAddr("udp4", "localhost:0")
    15  		Expect(err).ToNot(HaveOccurred())
    16  		udpConn, err := net.ListenUDP("udp4", addr)
    17  		Expect(err).ToNot(HaveOccurred())
    18  		conn, err := newConn(udpConn, true)
    19  		Expect(err).ToNot(HaveOccurred())
    20  		Expect(conn.Close()).To(Succeed())
    21  		Expect(conn.capabilities().DF).To(BeTrue())
    22  	})
    23  
    24  	It("works on IPv6", func() {
    25  		addr, err := net.ResolveUDPAddr("udp6", "[::1]:0")
    26  		Expect(err).ToNot(HaveOccurred())
    27  		udpConn, err := net.ListenUDP("udp6", addr)
    28  		Expect(err).ToNot(HaveOccurred())
    29  		conn, err := newConn(udpConn, false)
    30  		Expect(err).ToNot(HaveOccurred())
    31  		Expect(conn.Close()).To(Succeed())
    32  		Expect(conn.capabilities().DF).To(BeFalse())
    33  	})
    34  })