socket

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleName = "socket"

Variables

View Source
var (
	NoListenErr = errors.New("Module not enable to listen")
	NoDialErr   = errors.New("Module not enable to dial")
)
View Source
var Default = &Module{
	EnableListen:    true,
	EnableDial:      true,
	NetworkChecker:  nil,
	ListenerChecker: nil,
	DialerChecker:   nil,
}

Functions

func RegisterNativeModule

func RegisterNativeModule(r *require.Registry)

func Require

func Require(runtime *goja.Runtime, module *goja.Object)

Types

type DialerChecker

type DialerChecker = func(network string, laddr, raddr string) bool

func AllowDialTo

func AllowDialTo(hosts ...string) DialerChecker

func DisallowDialTo

func DisallowDialTo(hosts ...string) DialerChecker

type ListenerChecker

type ListenerChecker = func(network string, addr string) bool

func AllowListenOn

func AllowListenOn(hosts ...string) ListenerChecker

func DisallowListenOn

func DisallowListenOn(hosts ...string) ListenerChecker

type Module

type Module struct {
	EnableListen    bool
	EnableDial      bool
	NetworkChecker  NetworkChecker
	ListenerChecker ListenerChecker
	DialerChecker   DialerChecker
}

func (*Module) Dial

func (m *Module) Dial(call goja.FunctionCall, runtime *goja.Runtime) (v goja.Value)

func (*Module) Listen

func (m *Module) Listen(call goja.FunctionCall, runtime *goja.Runtime) (v goja.Value)

func (*Module) Require

func (m *Module) Require(runtime *goja.Runtime, module *goja.Object)

type NetworkChecker

type NetworkChecker = func(network string, mode string) bool

func NetworkNotOnList

func NetworkNotOnList(networks ...string) NetworkChecker

func NetworkOnList

func NetworkOnList(networks ...string) NetworkChecker

type TCPConn

type TCPConn struct {
	*events.EventEmitter

	Local  goja.Value
	Remote goja.Value
	// contains filtered or unexported fields
}

func (*TCPConn) Close

func (c *TCPConn) Close()

func (*TCPConn) Send

func (c *TCPConn) Send(buf []byte)

type TCPListener

type TCPListener struct {
	*events.EventEmitter

	Addr goja.Value
	// contains filtered or unexported fields
}

func (*TCPListener) Close

func (l *TCPListener) Close(a interface{})

type UDPConn

type UDPConn struct {
	*events.EventEmitter

	Local  goja.Value
	Remote goja.Value
	// contains filtered or unexported fields
}

func (*UDPConn) Close

func (c *UDPConn) Close()

func (*UDPConn) Send

func (c *UDPConn) Send(buf []byte)

func (*UDPConn) SendTo

func (c *UDPConn) SendTo(buf []byte, addr string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL