github.com/dorkamotorka/go/src@v0.0.0-20230614113921-187095f0e316/syscall/net_fake.go (about)

     1  // Copyright 2023 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  // Fake networking for js/wasm and wasip1/wasm.
     6  // This file only exists to make the compiler happy.
     7  
     8  //go:build (js && wasm) || wasip1
     9  
    10  package syscall
    11  
    12  const (
    13  	AF_UNSPEC = iota
    14  	AF_UNIX
    15  	AF_INET
    16  	AF_INET6
    17  )
    18  
    19  const (
    20  	SOCK_STREAM = 1 + iota
    21  	SOCK_DGRAM
    22  	SOCK_RAW
    23  	SOCK_SEQPACKET
    24  )
    25  
    26  const (
    27  	IPPROTO_IP   = 0
    28  	IPPROTO_IPV4 = 4
    29  	IPPROTO_IPV6 = 0x29
    30  	IPPROTO_TCP  = 6
    31  	IPPROTO_UDP  = 0x11
    32  )
    33  
    34  const (
    35  	_ = iota
    36  	IPV6_V6ONLY
    37  	SOMAXCONN
    38  	SO_ERROR
    39  )
    40  
    41  // Misc constants expected by package net but not supported.
    42  const (
    43  	_ = iota
    44  	F_DUPFD_CLOEXEC
    45  	SYS_FCNTL = 500 // unsupported
    46  )
    47  
    48  type Sockaddr any
    49  
    50  type SockaddrInet4 struct {
    51  	Port int
    52  	Addr [4]byte
    53  }
    54  
    55  type SockaddrInet6 struct {
    56  	Port   int
    57  	ZoneId uint32
    58  	Addr   [16]byte
    59  }
    60  
    61  type SockaddrUnix struct {
    62  	Name string
    63  }