network-infra-utility 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +21 -0
- data/CHANGELOG.md +31 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +70 -0
- data/Rakefile +1 -1
- data/bin/dns-query +834 -0
- data/bin/geo-doc +135 -0
- data/bin/geo-get +1 -1
- data/document/ASNum/346/250/241/345/235/227/345/212/237/350/203/275/350/257/264/346/230/216.md +242 -0
- data/document/DNSQuery/345/267/245/345/205/267/344/275/277/347/224/250/346/226/271/346/263/225.md +248 -0
- data/document/Geo/345/221/275/344/273/244/345/267/245/345/205/267/344/275/277/347/224/250/346/226/271/346/263/225.md +441 -0
- data/document/IP/346/250/241/345/235/227/345/212/237/350/203/275/350/257/264/346/230/216.md +297 -0
- data/document/MAC/346/250/241/345/235/227/345/212/237/350/203/275/350/257/264/346/230/216.md +296 -0
- data/document/SSH/350/277/236/346/216/245/345/256/242/346/210/267/347/253/257/344/275/277/347/224/250/346/226/271/346/263/225.md +764 -0
- data/network-infra-utility.gemspec +4 -2
- data/network.rb +3 -1
- data/service/geodb/GeoAPI.md +1 -0
- data/service/geodb/geodb.rb +278 -1
- data/service/ssh/README.md +942 -0
- data/service/ssh/bin/ssh-client +198 -0
- data/service/ssh/design/SSH/350/277/236/346/216/245/345/256/242/346/210/267/347/253/257/345/212/237/350/203/275/351/234/200/346/261/202/346/226/207/346/241/243.md +292 -0
- data/service/ssh/design/SSH/350/277/236/346/216/245/345/256/242/346/210/267/347/253/257/350/257/246/347/273/206/350/256/276/350/256/241/346/226/207/346/241/243.md +1521 -0
- data/service/ssh/design/SSH/350/277/236/346/216/245/345/256/242/346/210/267/347/253/257/350/275/257/344/273/266/350/256/276/350/256/241/346/226/207/346/241/243.md +2493 -0
- data/service/ssh/ext/ssh_core/bin/ssh_core.cmd +28 -0
- data/service/ssh/ext/ssh_core/config/sys.config +0 -0
- data/service/ssh/ext/ssh_core/config/vm.args +0 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/CHECKSUM +1 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/LICENSE +21 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/README.md +696 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/VERSION +1 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/contents.tar.gz +0 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/metadata.config +15 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/rebar.config +17 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/rebar.lock +1 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx.app.src +10 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx.erl +506 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_config.erl +393 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_config.hrl +18 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_consult.erl +81 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_decoder.erl +1909 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_encoder.erl +116 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_parser.erl +1214 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_to_json.erl +408 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_to_term.erl +389 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/jsx_verify.erl +121 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx.erl +506 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_config.erl +393 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_config.hrl +18 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_consult.erl +81 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_decoder.erl +1909 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_encoder.erl +116 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_parser.erl +1214 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_to_json.erl +408 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_to_term.erl +389 -0
- data/service/ssh/ext/ssh_core/local_deps/jsx/src/src/jsx_verify.erl +121 -0
- data/service/ssh/ext/ssh_core/rebar.config +24 -0
- data/service/ssh/ext/ssh_core/rebar.lock +1 -0
- data/service/ssh/ext/ssh_core/src/ssh_auth_engine.erl +156 -0
- data/service/ssh/ext/ssh_core/src/ssh_channel_stm.erl +232 -0
- data/service/ssh/ext/ssh_core/src/ssh_codec.erl +83 -0
- data/service/ssh/ext/ssh_core/src/ssh_conn_sup.erl +48 -0
- data/service/ssh/ext/ssh_core/src/ssh_conn_worker.erl +535 -0
- data/service/ssh/ext/ssh_core/src/ssh_core.app.src +36 -0
- data/service/ssh/ext/ssh_core/src/ssh_core_app.erl +11 -0
- data/service/ssh/ext/ssh_core/src/ssh_core_sup.erl +46 -0
- data/service/ssh/ext/ssh_core/src/ssh_infra_sup.erl +104 -0
- data/service/ssh/ext/ssh_core/src/ssh_ipc.hrl +80 -0
- data/service/ssh/ext/ssh_core/src/ssh_ipc_coalesce.erl +94 -0
- data/service/ssh/ext/ssh_core/src/ssh_ipc_gateway.erl +467 -0
- data/service/ssh/ext/ssh_core/src/ssh_ipc_proto.erl +95 -0
- data/service/ssh/ext/ssh_core/src/ssh_jump_chain.erl +101 -0
- data/service/ssh/ext/ssh_core/src/ssh_keepalive_mgr.erl +222 -0
- data/service/ssh/ext/ssh_core/src/ssh_known_hosts_proxy.erl +67 -0
- data/service/ssh/ext/ssh_core/src/ssh_port_fwd.erl +225 -0
- data/service/ssh/ext/ssh_core/src/ssh_sftp_session.erl +250 -0
- data/service/ssh/ext/ssh_core/src/ssh_sftp_sup.erl +62 -0
- data/service/ssh/ext/ssh_core_rs/Cargo.lock +2345 -0
- data/service/ssh/ext/ssh_core_rs/Cargo.toml +30 -0
- data/service/ssh/ext/ssh_core_rs/bin/ssh_core_rs +34 -0
- data/service/ssh/ext/ssh_core_rs/bin/ssh_core_rs.cmd +40 -0
- data/service/ssh/ext/ssh_core_rs/src/channel.rs +296 -0
- data/service/ssh/ext/ssh_core_rs/src/coalesce.rs +143 -0
- data/service/ssh/ext/ssh_core_rs/src/codec.rs +71 -0
- data/service/ssh/ext/ssh_core_rs/src/conn.rs +628 -0
- data/service/ssh/ext/ssh_core_rs/src/gateway.rs +389 -0
- data/service/ssh/ext/ssh_core_rs/src/handler.rs +293 -0
- data/service/ssh/ext/ssh_core_rs/src/keepalive.rs +194 -0
- data/service/ssh/ext/ssh_core_rs/src/main.rs +351 -0
- data/service/ssh/ext/ssh_core_rs/src/portfwd.rs +378 -0
- data/service/ssh/ext/ssh_core_rs/src/proto.rs +198 -0
- data/service/ssh/ext/ssh_core_rs/src/sftp.rs +294 -0
- data/service/ssh/lib/network_infra_utility/ssh/automation/macro_engine.rb +213 -0
- data/service/ssh/lib/network_infra_utility/ssh/client.rb +257 -0
- data/service/ssh/lib/network_infra_utility/ssh/config/schema.rb +90 -0
- data/service/ssh/lib/network_infra_utility/ssh/config/settings.rb +103 -0
- data/service/ssh/lib/network_infra_utility/ssh/config/store.rb +90 -0
- data/service/ssh/lib/network_infra_utility/ssh/ipc/coalesce.rb +83 -0
- data/service/ssh/lib/network_infra_utility/ssh/ipc/errors.rb +36 -0
- data/service/ssh/lib/network_infra_utility/ssh/ipc/router.rb +212 -0
- data/service/ssh/lib/network_infra_utility/ssh/ipc/transport.rb +81 -0
- data/service/ssh/lib/network_infra_utility/ssh/security/host_key.rb +211 -0
- data/service/ssh/lib/network_infra_utility/ssh/security/vault.rb +211 -0
- data/service/ssh/lib/network_infra_utility/ssh/session/history.rb +56 -0
- data/service/ssh/lib/network_infra_utility/ssh/session/manager.rb +92 -0
- data/service/ssh/lib/network_infra_utility/ssh/session/session.rb +109 -0
- data/service/ssh/lib/network_infra_utility/ssh/session/tree.rb +95 -0
- data/service/ssh/lib/network_infra_utility/ssh/terminal/ansi_parser.rb +435 -0
- data/service/ssh/lib/network_infra_utility/ssh/terminal/buffer.rb +78 -0
- data/service/ssh/lib/network_infra_utility/ssh/terminal/emulator.rb +159 -0
- data/service/ssh/lib/network_infra_utility/ssh/terminal/logger.rb +195 -0
- data/service/ssh/lib/network_infra_utility/ssh/terminal/screen.rb +212 -0
- data/service/ssh/lib/network_infra_utility/ssh/terminal/theme.rb +127 -0
- data/service/ssh/lib/network_infra_utility/ssh/version.rb +7 -0
- data/service/ssh/lib/network_infra_utility/ssh.rb +44 -0
- data/support/basic/as_num.rb +221 -0
- data/support/basic/mac_address.rb +281 -0
- data/version.rb +1 -1
- metadata +138 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52f005e254e4a41adb347cddd9ce08ab179fd7999e5f79db2de0171ba34a4284
|
|
4
|
+
data.tar.gz: d2cb8a65fec8e793de56c340305c7a545a6e5dd4e080128a2b1683bf2b606e3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54793aea84005bb72d73e5e7806148ecda0ca2bf3ad01e710252936a81922e6b129fedaaf5259e6233380af3eb18d6948b87a80ef5c9c1a077d821f364784b5a
|
|
7
|
+
data.tar.gz: dea8ac4214edf3f206f92e9586219b70363d10d4fb63d5c72dddbd223c933e38c6167cd015c02f69aefedb0a1db2ef7fdaa29fa28d2e6d7a559e57720cd8c8f1
|
data/.gitignore
CHANGED
|
@@ -55,3 +55,24 @@ build-iPhoneSimulator/
|
|
|
55
55
|
|
|
56
56
|
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
|
57
57
|
# .rubocop-https?--*
|
|
58
|
+
|
|
59
|
+
## Erlang/OTP build artifacts:
|
|
60
|
+
*.beam
|
|
61
|
+
*.appup
|
|
62
|
+
erl_crash.dump
|
|
63
|
+
/ebin/
|
|
64
|
+
/.eunit/
|
|
65
|
+
|
|
66
|
+
## rebar3 build:
|
|
67
|
+
.rebar3/
|
|
68
|
+
/_build/
|
|
69
|
+
**/_build/
|
|
70
|
+
/rebar3.crashdump
|
|
71
|
+
|
|
72
|
+
## erlang.mk build:
|
|
73
|
+
.erlang.mk/
|
|
74
|
+
/deps/
|
|
75
|
+
/_rel/
|
|
76
|
+
|
|
77
|
+
## Rust / Cargo build artifacts:
|
|
78
|
+
target/
|
data/CHANGELOG.md
CHANGED
|
@@ -8,12 +8,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.3.0] - 2026-07-26
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- 新增 `geo-load` 命令行工具:GeoLite2 CSV → JSON 转换,支持 `geo-load [RAW_DIR] [DOC_DIR]` 双位置参数,RAW_DIR 省略时在当前目录自动查找,DOC_DIR 省略时默认 `./geodb/`,不存在的输出目录自动创建。支持 `--asn-only` / `--city-only` / `--country-only` 单选转换。
|
|
16
|
+
- 新增 `geo-get` 命令行工具:向运行中的 geo-api 服务查询单个 IP 归属信息,一次输入三接口齐查,支持 `--text` / `--json` 两种输出格式与 `--country` / `--city` / `--asn` 单接口选择。
|
|
17
|
+
- `geo-load` / `geo-get` 加入 gemspec executables,`gem install` 后自动进入 PATH。
|
|
18
|
+
- 新增 example 文档:`ip_usage.md`(IP 模块代码级用法)、`geo_commands_usage.md`(Geo 三命令的命令行用法与代码级用法)。
|
|
19
|
+
|
|
20
|
+
## [0.2.0] - 2026-07-25
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- 新增 `IPv4` / `IPv6` / `IPv4Mask` / `IPv6Mask` 地址解析模块,提供地址分类、掩码运算、CIDR 展开、子网划分、区间相交判断等能力。
|
|
25
|
+
- 新增 `IP` 统一入口模块,提供 `v4` / `v6` / `range` / `cross` / `xross` 五个方法,按地址串自动分派 IPv4 / IPv6。
|
|
26
|
+
- 从原版 `network` gem(`utility/ipv4_address.rb` / `ipv6_address.rb`)迁移并重新编码。
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- ⚠️ **部分 IP 转换含义发生变化**,与原版 `network` gem(`utility/ipv4_address.rb` / `ipv6_address.rb`)不兼容,升级时需注意:
|
|
31
|
+
- `+` / `-` 算术运算从**破坏性**(原版直接修改 `@number` 并 `generate` 覆写自身)改为**非破坏性**(返回新对象,原对象不变)。
|
|
32
|
+
- `&` 按位与的返回值从原版的 `IP.v4(...)` / `IP.v6(...)`(依赖 `module IP` 上下文)改为直接 `IPv4.new` / `IPv6.new`,不再隐式依赖 `IP` 模块。
|
|
33
|
+
- `range_with` 原版返回 `[网络地址+1, 广播地址]`(排除了网络地址),新版改为 `[网络地址, 广播地址]`(含两端完整的网段区间)。
|
|
34
|
+
- `delegation` 的子网生成从原版的 `clone` + 破坏性 `+` 改为非破坏性 `base + offset`,返回的结果是独立对象。
|
|
35
|
+
- 方法命名规范化:原版的 `is_class_a?` / `is_mask?` / `is_private?` 等 `is_` 前缀方法保留为别名,新增无前缀的 `class_a?` / `mask?` / `private?` 等作为主方法名。
|
|
36
|
+
- `is_another?` 重命名为 `special?`(保留 `is_another?` 别名)。
|
|
37
|
+
- `IPv6` 非法地址从 `raise` + 返回 `nil` 的混合行为统一为抛出异常并附带 IPAddr 错误信息。
|
|
38
|
+
- `generate` 中的 `formmat` → `format_parts`、`check` / `checks` → `valid?`,内部方法名规范化,外部接口不变。
|
|
39
|
+
|
|
40
|
+
## [0.1.0] - 2026-07-24
|
|
41
|
+
|
|
11
42
|
### Added
|
|
12
43
|
|
|
13
44
|
- 初始化 gem 骨架,按 document / service / support / tool 四层 require_paths 组织代码。
|
|
14
45
|
- 配置 RSpec 原子能力测试(`spec/`)与功能用例(`example/`)双套结构。
|
|
15
46
|
- 提供标准 gem 文件:gemspec / Gemfile / Rakefile / .rspec / bin/console / bin/setup 等。
|
|
16
|
-
|
|
17
|
-
## [0.1.0] - Unreleased
|
|
18
|
-
|
|
19
|
-
- 项目初始化。
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
network-infra-utility (0.4.0)
|
|
5
|
+
json (~> 2.6)
|
|
6
|
+
puma (~> 6.0)
|
|
7
|
+
rackup (~> 2.0)
|
|
8
|
+
roda (~> 3.0)
|
|
9
|
+
thor (~> 1.3)
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: https://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
base64 (0.3.0)
|
|
15
|
+
diff-lcs (1.6.2)
|
|
16
|
+
json (2.20.0)
|
|
17
|
+
nio4r (2.7.5)
|
|
18
|
+
puma (6.6.1)
|
|
19
|
+
nio4r (~> 2.0)
|
|
20
|
+
rack (3.2.6)
|
|
21
|
+
rackup (2.3.1)
|
|
22
|
+
rack (>= 3)
|
|
23
|
+
rake (13.3.1)
|
|
24
|
+
roda (3.105.0)
|
|
25
|
+
rack
|
|
26
|
+
rspec (3.13.2)
|
|
27
|
+
rspec-core (~> 3.13.0)
|
|
28
|
+
rspec-expectations (~> 3.13.0)
|
|
29
|
+
rspec-mocks (~> 3.13.0)
|
|
30
|
+
rspec-core (3.13.6)
|
|
31
|
+
rspec-support (~> 3.13.0)
|
|
32
|
+
rspec-expectations (3.13.5)
|
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
34
|
+
rspec-support (~> 3.13.0)
|
|
35
|
+
rspec-mocks (3.13.8)
|
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
37
|
+
rspec-support (~> 3.13.0)
|
|
38
|
+
rspec-support (3.13.7)
|
|
39
|
+
thor (1.5.0)
|
|
40
|
+
|
|
41
|
+
PLATFORMS
|
|
42
|
+
x64-mingw-ucrt
|
|
43
|
+
|
|
44
|
+
DEPENDENCIES
|
|
45
|
+
base64 (~> 0.2)
|
|
46
|
+
network-infra-utility!
|
|
47
|
+
rake (~> 13.0)
|
|
48
|
+
rspec (~> 3.0)
|
|
49
|
+
thor (~> 1.3)
|
|
50
|
+
|
|
51
|
+
CHECKSUMS
|
|
52
|
+
base64 (0.3.0)
|
|
53
|
+
diff-lcs (1.6.2)
|
|
54
|
+
json (2.20.0)
|
|
55
|
+
network-infra-utility (0.4.0)
|
|
56
|
+
nio4r (2.7.5)
|
|
57
|
+
puma (6.6.1)
|
|
58
|
+
rack (3.2.6)
|
|
59
|
+
rackup (2.3.1)
|
|
60
|
+
rake (13.3.1)
|
|
61
|
+
roda (3.105.0)
|
|
62
|
+
rspec (3.13.2)
|
|
63
|
+
rspec-core (3.13.6)
|
|
64
|
+
rspec-expectations (3.13.5)
|
|
65
|
+
rspec-mocks (3.13.8)
|
|
66
|
+
rspec-support (3.13.7)
|
|
67
|
+
thor (1.5.0)
|
|
68
|
+
|
|
69
|
+
BUNDLED WITH
|
|
70
|
+
4.0.10
|