github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/internal/syscall/unix/net_darwin.go (about)

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package unix
     6  
     7  import (
     8  	"github.com/shogo82148/std/syscall"
     9  )
    10  
    11  const (
    12  	AI_CANONNAME = 0x2
    13  	AI_ALL       = 0x100
    14  	AI_V4MAPPED  = 0x800
    15  	AI_MASK      = 0x1407
    16  
    17  	EAI_AGAIN    = 2
    18  	EAI_NODATA   = 7
    19  	EAI_NONAME   = 8
    20  	EAI_SERVICE  = 9
    21  	EAI_SYSTEM   = 11
    22  	EAI_OVERFLOW = 14
    23  
    24  	NI_NAMEREQD = 4
    25  )
    26  
    27  type Addrinfo struct {
    28  	Flags     int32
    29  	Family    int32
    30  	Socktype  int32
    31  	Protocol  int32
    32  	Addrlen   uint32
    33  	Canonname *byte
    34  	Addr      *syscall.RawSockaddr
    35  	Next      *Addrinfo
    36  }
    37  
    38  func Getaddrinfo(hostname, servname *byte, hints *Addrinfo, res **Addrinfo) (int, error)
    39  
    40  func Freeaddrinfo(ai *Addrinfo)
    41  
    42  func Getnameinfo(sa *syscall.RawSockaddr, salen int, host *byte, hostlen int, serv *byte, servlen int, flags int) (int, error)
    43  
    44  func GaiStrerror(ecode int) string
    45  
    46  func GoString(p *byte) string
    47  
    48  type ResState struct {
    49  	unexported [69]uintptr
    50  }
    51  
    52  func ResNinit(state *ResState) error
    53  
    54  func ResNclose(state *ResState)
    55  
    56  func ResNsearch(state *ResState, dname *byte, class, typ int, ans *byte, anslen int) (int, error)