Skip to content
Myr

Merge commit from fork

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix(utils/ipaddr): validate IPv4 octet range in regex * refactor the regexp Co-authored-by: Taku Amano <taku@taaas.jp> ---------

authored by Yusuke Wada · committed by GitHub · parent 12c5117 · Browse files · 2 files+16 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Taku Amano <taku@taaas.jp>

Diff stats

2 files+16 added−1 removed

  • tests:+14 added−0 removed
  • other:+2 added−1 removed

2 files+16 added−1 removed

modified:src/utils/ipaddr.test.ts+14 added
modified:src/utils/ipaddr.ts+2 added-1 removed
31 unmodified lines
32 }33 return sections.join(':')34}3536const IPV4_REGEX = /^[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}$/36const IPV4_OCTET_PART = '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])'37const IPV4_REGEX = new RegExp(`^(?:${IPV4_OCTET_PART}\\.){3}${IPV4_OCTET_PART}$`)3839/**40 * Distinct Remote Addr41 * @param remoteAddr Remote Addr
100 unmodified lines