Documentation ¶
Index ¶
- type NetConn
- func (c *NetConn) Close() error
- func (c *NetConn) Recv(N int) ([]byte, error)
- func (c *NetConn) RecvFull(N int) ([]byte, error)
- func (c *NetConn) RecvFullHex(N int) (string, error)
- func (c *NetConn) RecvFullString(N int) (string, error)
- func (c *NetConn) RecvHex(N int) (string, error)
- func (c *NetConn) RecvString(N int) (string, error)
- func (c *NetConn) Send(data string) error
- func (c *NetConn) SendArray(data []interface{}) error
- func (c *NetConn) SendHex(data string) error
- func (c *NetConn) SetTimeout(value int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetConn ¶
type NetConn struct {
// contains filtered or unexported fields
}
NetConn is a connection to a remote host. this is returned/create by Open and OpenTLS functions. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); ```
func Open ¶
Open opens a new connection to the address with a timeout. supported protocols: tcp, udp @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); ```
func OpenTLS ¶
Open opens a new connection to the address with a timeout. supported protocols: tcp, udp @example ```javascript const net = require('nuclei/net'); const conn = net.OpenTLS('tcp', 'acme.com:443'); ```
func (*NetConn) Close ¶
Close closes the connection. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); conn.Close(); ```
func (*NetConn) Recv ¶
Recv is similar to RecvFull but does not guarantee full read instead it creates a buffer of N bytes and returns whatever is returned by the connection for reading headers or initial bytes from the server this is usually used. for reading a fixed number of already known bytes (ex: body based on content-length) use RecvFull. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); const data = conn.Recv(1024); log(`Received ${data.length} bytes from the server`) ```
func (*NetConn) RecvFull ¶ added in v3.2.0
RecvFull receives data from the connection with a timeout. If N is 0, it will read all data sent by the server with 8MB limit. it tries to read until N bytes or timeout is reached. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); const data = conn.RecvFull(1024); ```
func (*NetConn) RecvFullHex ¶ added in v3.2.0
RecvFullHex receives data from the connection with a timeout in hex format. If N is 0,it will read all data sent by the server with 8MB limit. until N bytes or timeout is reached. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); const data = conn.RecvFullHex(1024); ```
func (*NetConn) RecvFullString ¶ added in v3.2.0
RecvFullString receives data from the connection with a timeout output is returned as a string. If N is 0, it will read all data sent by the server with 8MB limit. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); const data = conn.RecvFullString(1024); ```
func (*NetConn) RecvHex ¶
RecvHex is similar to RecvFullHex but does not guarantee full read instead it creates a buffer of N bytes and returns whatever is returned by the connection for reading headers or initial bytes from the server this is usually used. for reading a fixed number of already known bytes (ex: body based on content-length) use RecvFull. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); const data = conn.RecvHex(1024); ```
func (*NetConn) RecvString ¶
RecvString is similar to RecvFullString but does not guarantee full read, instead it creates a buffer of N bytes and returns whatever is returned by the connection for reading headers or initial bytes from the server this is usually used. for reading a fixed number of already known bytes (ex: body based on content-length) use RecvFullString. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); const data = conn.RecvString(1024); ```
func (*NetConn) Send ¶
Send sends data to the connection with a timeout. @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); conn.Send('hello'); ```
func (*NetConn) SendArray ¶
SendArray sends array data to connection @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); conn.SendArray(['hello', 'world']); ```
func (*NetConn) SendHex ¶
SendHex sends hex data to connection @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); conn.SendHex('68656c6c6f'); ```
func (*NetConn) SetTimeout ¶
SetTimeout sets read/write timeout for the connection (in seconds). @example ```javascript const net = require('nuclei/net'); const conn = net.Open('tcp', 'acme.com:80'); conn.SetTimeout(10); ```