mirror of
https://github.com/tinygo-org/net.git
synced 2026-08-12 07:33:37 +00:00
stub out more types/funcs to compile against golang.org/x/net/internal/socket (#17)
* stub out more types/funcs to compile against golang.org/x/net/internal/socket These are changes need to compile github.com/domainr/dnsr/ with TinyGo. See issue tinygo-org/net#14. These change are mostly to fix missing symbols in src/net. Missing types and functions are cut-and-pasted from go1.21.4. Functions are stubbed out returning errors.New("not implemented"). DNRS is compiled by running tinygo test: sfeldma@nuc:~/work/dnsr$ tinygo test -target=wasi With this patch, and a corresponding patch for tinygo/ to fixup crypto/tls, you should get a clean compile.
This commit is contained in:
@@ -14,7 +14,9 @@ package net
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -24,6 +26,9 @@ const (
|
||||
defaultTCPKeepAlive = 15 * time.Second
|
||||
)
|
||||
|
||||
// mptcpStatus is a tristate for Multipath TCP, see go.dev/issue/56539
|
||||
type mptcpStatus uint8
|
||||
|
||||
// A Dialer contains options for connecting to an address.
|
||||
//
|
||||
// The zero value for each field is equivalent to dialing
|
||||
@@ -146,6 +151,46 @@ func (d *Dialer) DialContext(ctx context.Context, network, address string) (Conn
|
||||
return nil, fmt.Errorf("Network %s not supported", network)
|
||||
}
|
||||
|
||||
// ListenConfig contains options for listening to an address.
|
||||
type ListenConfig struct {
|
||||
// If Control is not nil, it is called after creating the network
|
||||
// connection but before binding it to the operating system.
|
||||
//
|
||||
// Network and address parameters passed to Control method are not
|
||||
// necessarily the ones passed to Listen. For example, passing "tcp" to
|
||||
// Listen will cause the Control function to be called with "tcp4" or "tcp6".
|
||||
Control func(network, address string, c syscall.RawConn) error
|
||||
|
||||
// KeepAlive specifies the keep-alive period for network
|
||||
// connections accepted by this listener.
|
||||
// If zero, keep-alives are enabled if supported by the protocol
|
||||
// and operating system. Network protocols or operating systems
|
||||
// that do not support keep-alives ignore this field.
|
||||
// If negative, keep-alives are disabled.
|
||||
KeepAlive time.Duration
|
||||
|
||||
// If mptcpStatus is set to a value allowing Multipath TCP (MPTCP) to be
|
||||
// used, any call to Listen with "tcp(4|6)" as network will use MPTCP if
|
||||
// supported by the operating system.
|
||||
mptcpStatus mptcpStatus
|
||||
}
|
||||
|
||||
// Listen announces on the local network address.
|
||||
//
|
||||
// See func Listen for a description of the network and address
|
||||
// parameters.
|
||||
func (lc *ListenConfig) Listen(ctx context.Context, network, address string) (Listener, error) {
|
||||
return nil, errors.New("dial:ListenConfig:Listen not implemented")
|
||||
}
|
||||
|
||||
// ListenPacket announces on the local network address.
|
||||
//
|
||||
// See func ListenPacket for a description of the network and address
|
||||
// parameters.
|
||||
func (lc *ListenConfig) ListenPacket(ctx context.Context, network, address string) (PacketConn, error) {
|
||||
return nil, errors.New("dial:ListenConfig:ListenPacket not implemented")
|
||||
}
|
||||
|
||||
// Listen announces on the local network address.
|
||||
//
|
||||
// See Go "net" package Listen() for more information.
|
||||
|
||||
Reference in New Issue
Block a user