Skip to content

std net package does not supported in wasm/wasi #2704

Open
@Cylkal

Description

@Cylkal

Problem description

code example:

package main

import (
	"net"
	"time"
)

func main() {
	_, _ = net.DialTimeout("tcp", ":80", time.Second)
}

compile command:
tinygo build -o demo.wasm -target=wasi ./test.go

out:

# command-line-arguments
test.go:9:13: DialTimeout not declared by package net

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:

# golang.org/x/crypto/ssh
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:71:54: TCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:104:39: TCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:183:51: TCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:289:13: TCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:389:54: TCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/client.go:173:19: DialTimeout not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/server.go:299:28: TCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/streamlocal.go:47:28: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/streamlocal.go:85:15: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/streamlocal.go:89:15: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/streamlocal.go:99:30: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/streamlocal.go:112:14: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:27:21: ResolveTCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:191:14: TCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:231:17: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:235:17: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:355:20: TCPAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:372:16: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:376:16: UnixAddr not declared by package net
../../../../go/pkg/mod/golang.org/x/[email protected]/ssh/tcpip.go:391:16: TCPAddr not declared by package net

As we can see, ssh import net package which does not support many methods or types it reqiuired.

Is there any plan to support the official net library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestwasmWebAssembly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions