Open Cylkal opened 2 years ago
WASI does seem to have the beginnings of support for sockets, see https://radu-matei.com/blog/towards-sockets-networking-wasi/ https://github.com/WebAssembly/WASI/pull/312 https://github.com/bytecodealliance/wasmtime/issues/70 https://github.com/WebAssembly/wasi-sockets and there has been a tiny bit of discussion about it in tinygo slack, https://gophers.slack.com/archives/CDJD3SUP6/p1645868342147429 but as yet nobody has wired it up.
I have not tried this, but the following may be helpful.
tinynet implements a subnet of the Go net package. Because it is based on unisockets, it supports more platforms (WASM/JS, WASM/WASI, TinyGo, Go etc.) than the official net package.
same issue here is my error log
# golang.org/x/crypto/ssh
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:289:13: undefined: net.TCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:71:54: undefined: net.TCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:104:39: undefined: net.TCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:183:51: undefined: net.TCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:389:54: undefined: net.TCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/client.go:177:19: undefined: net.DialTimeout
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/server.go:300:28: undefined: net.TCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/streamlocal.go:47:28: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/streamlocal.go:85:15: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/streamlocal.go:89:15: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/streamlocal.go:99:30: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/streamlocal.go:112:14: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:27:21: undefined: net.ResolveTCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:191:14: undefined: net.TCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:231:17: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:235:17: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:355:20: undefined: net.TCPAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:372:16: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:376:16: undefined: net.UnixAddr
../home/tinygo/go/pkg/mod/golang.org/x/crypto@v0.0.0-20220722155217-630584e8d5aa/ssh/tcpip.go:391:16: undefined: net.TCPAddr
Is it worked on? if not where should I work to help its development?
See: https://github.com/tinygo-org/tinygo/pull/3704 (I haven't followed the development very closely).
Also one more query does tinygo support cobra cli package? I know its not the right place but whom to ask😕
@dipankardas011 you can test so for yourself, it only takes a few seconds :wink:
Problem description
code example:
compile command:
tinygo build -o demo.wasm -target=wasi ./test.go
out:
Background
When I want to import package
golang.org/x/crypto/ssh
, trying to connect to ssh server in a wasm module, some err occurs while compile:As we can see,
ssh
importnet
package which does not support many methods or types it reqiuired.Is there any plan to support the official
net
library?