Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for As4 (0.03 sec)

  1. src/net/netip/netip.go

    	return a16
    }
    
    // As4 returns an IPv4 or IPv4-in-IPv6 address in its 4-byte representation.
    // If ip is the zero [Addr] or an IPv6 address, As4 panics.
    // Note that 0.0.0.0 is not the zero Addr.
    func (ip Addr) As4() (a4 [4]byte) {
    	if ip.z == z4 || ip.Is4In6() {
    		byteorder.BePutUint32(a4[:], uint32(ip.addr.lo))
    		return a4
    	}
    	if ip.z == z0 {
    		panic("As4 called on IP zero value")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 17:10:01 UTC 2024
    - 43.2K bytes
    - Viewed (0)
  2. src/net/netip/netip_test.go

    		},
    		{
    			ip:        mustIP("::1"),
    			wantPanic: true,
    		},
    	}
    	as4 := func(ip Addr) (v [4]byte, gotPanic bool) {
    		defer func() {
    			if recover() != nil {
    				gotPanic = true
    				return
    			}
    		}()
    		v = ip.As4()
    		return
    	}
    	for i, tt := range tests {
    		got, gotPanic := as4(tt.ip)
    		if gotPanic != tt.wantPanic {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 17:10:01 UTC 2024
    - 54.3K bytes
    - Viewed (0)
  3. src/net/ipsock_posix.go

    	addr := ap.Addr()
    	if !addr.Is4() {
    		return syscall.SockaddrInet4{}, &AddrError{Err: "non-IPv4 address", Addr: addr.String()}
    	}
    	sa := syscall.SockaddrInet4{
    		Addr: addr.As4(),
    		Port: int(ap.Port()),
    	}
    	return sa, nil
    }
    
    func addrPortToSockaddrInet6(ap netip.AddrPort) (syscall.SockaddrInet6, error) {
    	// ipToSockaddrInet6 has special handling here for zero length slices.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 8.6K bytes
    - Viewed (0)
  4. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"(*AddrPort).UnmarshalText", Method, 18},
    		{"(*Prefix).UnmarshalBinary", Method, 18},
    		{"(*Prefix).UnmarshalText", Method, 18},
    		{"(Addr).AppendTo", Method, 18},
    		{"(Addr).As16", Method, 18},
    		{"(Addr).As4", Method, 18},
    		{"(Addr).AsSlice", Method, 18},
    		{"(Addr).BitLen", Method, 18},
    		{"(Addr).Compare", Method, 18},
    		{"(Addr).Is4", Method, 18},
    		{"(Addr).Is4In6", Method, 18},
    		{"(Addr).Is6", Method, 18},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
Back to top