| 1 |
// +build js |
| 2 |
|
| 3 |
package net |
| 4 |
|
| 5 |
import ( |
| 6 |
"errors" |
| 7 |
"syscall" |
| 8 |
|
| 9 |
"github.com/gopherjs/gopherjs/js" |
| 10 |
) |
| 11 |
|
| 12 |
func Listen(net, laddr string) (Listener, error) { |
| 13 |
panic(errors.New("network access is not supported by GopherJS")) |
| 14 |
} |
| 15 |
|
| 16 |
func (d *Dialer) Dial(network, address string) (Conn, error) { |
| 17 |
panic(errors.New("network access is not supported by GopherJS")) |
| 18 |
} |
| 19 |
|
| 20 |
func sysInit() { |
| 21 |
} |
| 22 |
|
| 23 |
func probeIPv4Stack() bool { |
| 24 |
return false |
| 25 |
} |
| 26 |
|
| 27 |
func probeIPv6Stack() (supportsIPv6, supportsIPv4map bool) { |
| 28 |
return false, false |
| 29 |
} |
| 30 |
|
| 31 |
func probeWindowsIPStack() (supportsVistaIP bool) { |
| 32 |
return false |
| 33 |
} |
| 34 |
|
| 35 |
func maxListenerBacklog() int { |
| 36 |
return syscall.SOMAXCONN |
| 37 |
} |
| 38 |
|
| 39 |
// Copy of strings.IndexByte. |
| 40 |
func byteIndex(s string, c byte) int { |
| 41 |
return js.InternalObject(s).Call("indexOf", js.Global.Get("String").Call("fromCharCode", c)).Int() |
| 42 |
} |
| 43 |
|
| 44 |
// Copy of bytes.Equal. |
| 45 |
func bytesEqual(x, y []byte) bool { |
| 46 |
if len(x) != len(y) { |
| 47 |
return false |
| 48 |
} |
| 49 |
for i, b := range x { |
| 50 |
if b != y[i] { |
| 51 |
return false |
| 52 |
} |
| 53 |
} |
| 54 |
return true |
| 55 |
} |
| 56 |
|
| 57 |
// Copy of bytes.IndexByte. |
| 58 |
func bytesIndexByte(s []byte, c byte) int { |
| 59 |
for i, b := range s { |
| 60 |
if b == c { |
| 61 |
return i |
| 62 |
} |
| 63 |
} |
| 64 |
return -1 |
| 65 |
} |