New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

srnet

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

srnet

SRNET/2.0 server and client

latest
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

Send and Return NETwork Protocol 2.0

Changes from SRP/1.0

  • Operations

    FIN=0,OP=0000000,DATA=Data
    
    +-+-------+------------------------------+
    |F| opcode|                              |
    |I|  (7)  |             DATA             |
    |N|  OP   |         (128 bytes)          |
    +-+-------+------------------------------+
    

    FIN: 1 bit

    If data is longer than 128 bytes, FIN must be 0 and send it once.

    Opcode: 7 bit

    • 0000000 ECHO

    • 0000001 BROADCAST

    • 0000010 WAIT

      Wait by milliseconds.

    • 0000011 DATE/TIME

      Return date and time.

    • 0000100 DISCONNECT

      Disconnect from seever.

    • 0000101 DISCOVER

      Get IDs of all clients.

    • 0000110 SEND

      Send data to another client.

      ID must be selected by DATA.

      If you sent it, server will return <ASK> SEND, then you must send request for it.

    • 0000111 RECV

      Send request to anther client.

      ID must be selected by DATA.

      If you sent it, server will return <ASK> RECV, then you must send request for it.

Usage of server

var express = require("express");
var app = express();
var srnet = require("srnet");
var srnet_server = srnet.server();
app.use(srnet_server);
app.listen();

Usage of client

var srnet = require("srnet");
var srnet_client = srnet.client("url");

Events of server and client:

  • connection / connect

  • disconnect (server)

  • data(client)

    Receives processed data without first.

  • data(server)

    Receives data from client.

  • rawData (client)

    Receives all raw data without first.

  • allRawData (client)

    Receives all raw data.

  • receive (client)

    Receives processed data if data starts with "#" and data doesn't mean error.

  • error (client)

    Receives error object if data starts with "#" and data means error.

  • unknown (client)

    Receives processed data if data starts with "#" and data is returning unknown status code.

  • send / recv (client)

    Receives processed data if client received <ASK> SEND or <ASK> RECV.

FAQs

Package last updated on 04 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts