fd_js.mx raw

   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. It is intended to allow tests of other package to pass.
   6  
   7  //go:build js
   8  
   9  package net
  10  
  11  import (
  12  	"os"
  13  	"syscall"
  14  )
  15  
  16  func (fd *netFD) closeRead() error {
  17  	if fd.fakeNetFD != nil {
  18  		return fd.fakeNetFD.closeRead()
  19  	}
  20  	return os.NewSyscallError("closeRead", syscall.ENOTSUP)
  21  }
  22  
  23  func (fd *netFD) closeWrite() error {
  24  	if fd.fakeNetFD != nil {
  25  		return fd.fakeNetFD.closeWrite()
  26  	}
  27  	return os.NewSyscallError("closeRead", syscall.ENOTSUP)
  28  }
  29