mirror of
https://github.com/jimeh/rands.git
synced 2026-02-19 11:26:38 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6a03122985
|
|||
|
53f7741451
|
|||
|
16e33f432c
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -52,7 +52,7 @@ jobs:
|
||||
- name: Fix benchmark names
|
||||
run: >-
|
||||
perl -pe 's/^(Benchmark.+?)\/(\S+)(-\d+)(\s+)/\1__\2\4/' output.raw |
|
||||
tr '-' '_' | tee output.txt
|
||||
tr '=-' '_' | tee output.txt
|
||||
- name: Announce benchmark result
|
||||
uses: rhysd/github-action-benchmark@v1
|
||||
with:
|
||||
@@ -128,7 +128,7 @@ jobs:
|
||||
- name: Fix benchmark names
|
||||
run: >-
|
||||
perl -pe 's/^(Benchmark.+?)\/(\S+)(-\d+)(\s+)/\1__\2\4/' output.raw |
|
||||
tr '-' '_' | tee output.txt
|
||||
tr '=-' '_' | tee output.txt
|
||||
- name: Store benchmark result
|
||||
uses: rhysd/github-action-benchmark@v1
|
||||
with:
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [0.1.1](https://github.com/jimeh/rands/compare/v0.1.0...v0.1.1) (2021-01-20)
|
||||
|
||||
## 0.1.0 (2021-01-20)
|
||||
|
||||
|
||||
|
||||
10
strings.go
10
strings.go
@@ -164,11 +164,11 @@ func UnicodeString(n int, alphabet []rune) (string, error) {
|
||||
}
|
||||
|
||||
// DNSLabel returns a random string of n length in a DNS label compliant format
|
||||
// as defined in RFC 1035, section 2.3.1, Preferred name syntax:
|
||||
// https://tools.ietf.org/html/rfc1035#section-2.3.1
|
||||
// as defined in RFC 1035, section 2.3.1:
|
||||
// https://www.rfc-editor.org/rfc/rfc1035.html#section-2.3.1
|
||||
//
|
||||
// It also adheres to RFC 5891, section 4.2.3.1, Hyphen Restrictions:
|
||||
// https://tools.ietf.org/html/rfc5891#section-4.2.3.1
|
||||
// It also adheres to RFC 5891, section 4.2.3.1:
|
||||
// https://www.rfc-editor.org/rfc/rfc5891.html#section-4.2.3.1
|
||||
//
|
||||
// In summary, the generated random string will:
|
||||
//
|
||||
@@ -177,7 +177,7 @@ func UnicodeString(n int, alphabet []rune) (string, error) {
|
||||
// - last character will be one of a-z or 0-9
|
||||
// - in-between first and last characters consist of a-z, 0-9, or "-"
|
||||
// - potentially contain two or more consecutive "-", except the 3rd and 4th
|
||||
// characters, as that would violate RFC 5891.
|
||||
// characters, as that would violate RFC 5891, section 4.2.3.1.
|
||||
func DNSLabel(n int) (string, error) {
|
||||
switch {
|
||||
case n < 1 || n > 63:
|
||||
|
||||
Reference in New Issue
Block a user