Source file src/net/sockopt_fake.go

     1  // Copyright 2011 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 js || wasip1
     6  
     7  package net
     8  
     9  import "syscall"
    10  
    11  func setDefaultSockopts(s, family, sotype int, ipv6only bool) error {
    12  	return nil
    13  }
    14  
    15  func setDefaultListenerSockopts(s int) error {
    16  	return nil
    17  }
    18  
    19  func setDefaultMulticastSockopts(s int) error {
    20  	return nil
    21  }
    22  
    23  func setReadBuffer(fd *netFD, bytes int) error {
    24  	if fd.fakeNetFD != nil {
    25  		return fd.fakeNetFD.setReadBuffer(bytes)
    26  	}
    27  	return syscall.ENOPROTOOPT
    28  }
    29  
    30  func setWriteBuffer(fd *netFD, bytes int) error {
    31  	if fd.fakeNetFD != nil {
    32  		return fd.fakeNetFD.setWriteBuffer(bytes)
    33  	}
    34  	return syscall.ENOPROTOOPT
    35  }
    36  
    37  func setKeepAlive(fd *netFD, keepalive bool) error {
    38  	return syscall.ENOPROTOOPT
    39  }
    40  
    41  func setLinger(fd *netFD, sec int) error {
    42  	if fd.fakeNetFD != nil {
    43  		return fd.fakeNetFD.setLinger(sec)
    44  	}
    45  	return syscall.ENOPROTOOPT
    46  }
    47  

View as plain text