Black Lives Matter. Support the Equal Justice Initiative.

Source file src/net/sockaddr_posix.go

Documentation: net

     1  // Copyright 2018 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  //go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
     6  // +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
     7  
     8  package net
     9  
    10  import (
    11  	"syscall"
    12  )
    13  
    14  // A sockaddr represents a TCP, UDP, IP or Unix network endpoint
    15  // address that can be converted into a syscall.Sockaddr.
    16  type sockaddr interface {
    17  	Addr
    18  
    19  	// family returns the platform-dependent address family
    20  	// identifier.
    21  	family() int
    22  
    23  	// isWildcard reports whether the address is a wildcard
    24  	// address.
    25  	isWildcard() bool
    26  
    27  	// sockaddr returns the address converted into a syscall
    28  	// sockaddr type that implements syscall.Sockaddr
    29  	// interface. It returns a nil interface when the address is
    30  	// nil.
    31  	sockaddr(family int) (syscall.Sockaddr, error)
    32  
    33  	// toLocal maps the zero address to a local system address (127.0.0.1 or ::1)
    34  	toLocal(net string) sockaddr
    35  }
    36  

View as plain text