Skip to content

Repository files navigation

protocols(wip)

包含多个npm库,用于简化二进制协议的实现

typebuffer

一个简单的二进制读写库,可用于定义复杂的协议

安装方式

npm install typebuffer

例子:socks5例子

import{Types}from"typebuffer";exportconstTypeAddress=Types.Struct().define("family",Types.UInt8()).switch("family",{0x01: ["ipv4",Types.IPV4()],0x03: ["domain",Types.Domain()],0x04: ["ipv6",Types.IPV6BE()],})exportconstVersion=Types.Struct().define("version",Types.UInt8(0x05))exportconstNegotiate=Types.Struct(Version).define("nmethods",Types.UInt8())exportconstNegotiateReply=Types.Struct(Version).define("method",Types.UInt8())exportconstAuth=Types.Struct(Version).define("uname",Types.L8String()).define("passwd",Types.L8String())exportconstAuthReply=Types.Struct(Version).define("status",Types.UInt8())exportconstRequest=Types.Struct(Version).define("cmd",Types.UInt8()).define("rsv",Types.UInt8(0x00)).define("address",TypeAddress).define("port",Types.UInt16BE())exportconstReply=Types.Struct(Version).define("reply",Types.UInt8()).define("rsv",Types.UInt8(0x00)).define("bind",TypeAddress).define("port",Types.UInt16BE())

typeprotols

预定义了很多二进制协议的库,方便进一步开发。

已有协议包含如下

  • socks5
  • vless
  • ws
  • mux

About

一个用于简化协议实现的库

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages