From 5b0908e84236dc7a6f221e6bdfb68644404234fa Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Mon, 26 Aug 2024 15:53:38 -0700 Subject: [PATCH] InternetHostName() --- default.go | 5 ++ t_internethostname.go | 44 ++++++++++++ tlds.go | 156 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 t_internethostname.go create mode 100644 tlds.go diff --git a/default.go b/default.go index 6088a3b..a065a27 100644 --- a/default.go +++ b/default.go @@ -21,6 +21,11 @@ func HTMLFile() fs.File { return Default.HTMLFile() } +// InternetHostName returns an arbitrary Internet hostname. +func InternetHostName() string { + return Default.InternetHostName() +} + // NetAddr returns an arbitrary net.Addr. func NetAddr() net.Addr { return Default.NetAddr() diff --git a/t_internethostname.go b/t_internethostname.go new file mode 100644 index 0000000..9961bc2 --- /dev/null +++ b/t_internethostname.go @@ -0,0 +1,44 @@ +package arbitrary + +import ( + "fmt" + "strings" +) + +// InternetHostName returns an arbitrary Internet hostname. +func (arb T) InternetHostName() string { + + var partchars string = "0123456789abcdefghijklmnopqrstuvwxyz" + + var tld string = tlds[arb.randomness.Intn(len(tlds))] + + var parts []string + + { + var numparts int = 1 + arb.randomness.Intn(3) + + for i:=0; i