#tcp-connection #tcp #proxy #logging #networking #incoming-connection

bin+lib proxy_logger

命令行界面,用于将带有负载输出的 TCP 连接代理到控制台,可以以不同的方式格式化

5 个版本

0.1.4 2024 年 7 月 9 日
0.1.3 2024 年 6 月 21 日
0.1.2 2024 年 6 月 21 日
0.1.1 2024 年 6 月 21 日
0.1.0 2024 年 6 月 21 日

#205 in 调试

Download history 133/week @ 2024-06-15 53/week @ 2024-06-22 5/week @ 2024-06-29 121/week @ 2024-07-06 7/week @ 2024-07-13 16/week @ 2024-07-27

每月 145 次下载

MIT/Apache

19KB
309 代码行数

proxy_logger

Crates.io Rust version License Workflow Status

描述

此存储库提供了一个命令行界面,用于将带有负载输出的 TCP 连接代理到控制台。负载输出可以以不同的方式格式化:十六进制(小写和大写)、十进制、八进制和二进制。

安装

运行以下命令,直到代码库编译完成

$ cargo install proxy_logger

现在你可以运行编译后的二进制文件

$ proxy_logger --bind-listener-addr 127.0.0.1:20502 --remote-addr 127.0.0.1:20582

从 Git 仓库

运行以下命令,直到代码库编译完成

$ cargo install --git https://github.com/obaraelijah/proxy_logger.git --tag v0.1.3 proxy_logger

您还可以删除标签选项以安装最新的开发版本。

现在你可以运行编译后的二进制文件

$ proxy_logger --bind-listener-addr 127.0.0.1:20502 --remote-addr 127.0.0.1:20582

选项

以下是目前支持选项的列表。

$ proxy_logger --help
Command line interface for proxying TCP connections with payload output into console which can be formatted different ways.

Usage: proxy_logger [OPTIONS] --bind-listener-addr <BIND_LISTENER_ADDR> --remote-addr <REMOTE_ADDR>

Options:
  -l, --level <LEVEL>
          Application logging level [default: debug] [possible values: trace, debug, info, warn, error, off]
  -b, --bind-listener-addr <BIND_LISTENER_ADDR>
          Address on which TCP listener should be binded
  -r, --remote-addr <REMOTE_ADDR>
          Address of remote server
  -t, --timeout <TIMEOUT>
          Incoming connection reading timeout [default: 60]
  -f, --formatting <FORMATTING>
          Formatting of console payload output, [default: lowerhex] [possible values: decimal, lowerhex, upperhex, binary, octal]
  -s, --separator <SEPARATOR>
          Console payload output bytes separator [default: :]
  -p, --precision <PRECISION>
          Timestamp precision [default: seconds] [possible values: seconds, milliseconds, microseconds, nanoseconds]
  -h, --help
          Print help
  -V, --version
          Print version

示例

以下是一个使用此命令行工具作为设备与数据存储服务器之间代理的示例,包括命令和控制台输出。

$ proxy_logger --bind-listener-addr 127.0.0.1:20502 --remote-addr 127.0.0.1:20582
[2024-06-04T02:39:33Z INFO] Listener binded, waiting for incoming connections...
[2024-06-04T02:39:37Z INFO] Incoming connection from 127.0.0.1:50376
[2024-06-04T02:39:37Z DEBUG] < 00:00:00:00:00:19:6f:03:16:00:1f:00:20:00:11:00:22:00:33:00:44:00:55:00:66:00:01:00:00:00:00
[2024-06-04T02:39:37Z DEBUG] > 00:00:00:00:00:0b:6f:10:03:f1:00:02:04:00:00:00:00
[2024-06-04T02:39:37Z DEBUG] < 00:00:00:00:00:06:6f:10:03:f1:00:02
[2024-06-04T02:39:37Z DEBUG] > 00:01:00:00:00:06:6f:03:00:7a:00:01:00:02:00:00:00:06:6f:03:00:7b:00:02
[2024-06-04T02:39:37Z DEBUG] < 00:01:00:00:00:05:6f:03:02:02:ff:00:02:00:00:00:07:6f:03:04:00:00:00:01
[2024-06-04T02:39:37Z DEBUG] > 00:03:00:00:00:06:01:01:00:01:00:01:00:04:00:00:00:06:01:02:00:01:00:01:00:05:00:00:00:06:01:03:00:01:00:10:00:06:00:00:00:06:01:03:00:11:00:01:00:07:00:00:00:06:01:03:00:7b:00:01:00:08:00:00:00:06:01:03:0f:a0:00:01:00:09:00:00:00:06:01:03:13:88:00:03:00:0a:00:00:00:06:01:04:00:01:00:01
[2024-06-04T02:39:37Z DEBUG] < 00:03:00:00:00:04:01:01:01:01:00:04:00:00:00:04:01:02:01:01:00:05:00:00:00:23:01:03:20:00:7b:00:0c:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:01:36:40:49:0f:db:40:09:21:fb:54:44:2d:18:ff:ff:00:06:00:00:00:05:01:03:02:ff:ff:00:07:00:00:00:05:01:03:02:00:01:00:08:00:00:00:03:01:83:02:00:09:00:00:00:09:01:03:06:00:01:00:02:00:03:00:0a:00:00:00:05:01:04:02:00:7b
[2024-06-04T02:40:18Z DEBUG] > 00:0b:00:00:00:06:6f:03:03:e8:00:01
[2024-06-04T02:40:18Z DEBUG] < 00:0b:00:00:00:05:6f:03:02:00:00

许可

许可方式为以下之一

任选其一。

贡献

除非您明确声明,否则根据 Apache-2.0 许可证定义的,您有意提交的任何贡献,均应按照上述方式双重许可,不附加任何额外条款或条件。

依赖

~5–14MB
~158K SLoC