Allow reading unmasked address when passed a CIDR string
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- ruby
- 领域
- networking
调研方向
从 lib/ipaddr.rb 的第 649-651 行开始,跟踪 CIDR 字符串的解析和存储方式。将当前的地址和网络掩码访问器与所请求的行为进行比较,然后定义 API 变更,使 1.2.3.4/16 的未屏蔽地址和网络掩码都可以被读回。
由索引模型根据 Issue 内容生成。
描述
This behavior caught me by surprise:
> ip = IPAddr.new('1.2.3.4/16')
=> #<IPAddr: IPv4:1.2.0.0/255.255.0.0>
> ip.to_s
=> "1.2.0.0"
Looking at the code I believe this is happening at https://github.com/ruby/ipaddr/blob/master/lib/ipaddr.rb#L649-L651, which is a very old commit, so this behavior is clearly expected. For my use case I need the host bits unmasked, so I want to parse 1.2.3.4/16 and be able to read back something like ip.address as 1.2.3.4 and the netmask as 255.255.0.0. It looks like that's not currently possible with this gem, which surprises me. Am I overlooking a method, or is there a nuance in the CIDR spec implemented here I've forgotten?
- 主要语言
- Ruby
- 星标
- 82
- 派生
- 42
- 平均合并
- 2 小时 24 分钟
- 30 天内合并 PR
- 3
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ruby/ipaddr 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 64/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 46/100
相似的 Issue
-
user-reported
难度 2/5 1-3 小时 新手友好度 85/100
Kong/developer.konghq.com#7316 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
TheOdinProject/curriculum#31408 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 74/100
bensheldon/good_job#1816 · 5 条评论 ·