Class: Synthra::Types::TechnologyInternet::IpV6Cidr

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/technology_internet/networking.rb

Overview

IpV6Cidr type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



133
134
135
# File 'lib/synthra/types/technology_internet/networking.rb', line 133

def generate_edge(rng, context, args)
  ["::/0", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



137
138
139
# File 'lib/synthra/types/technology_internet/networking.rb', line 137

def generate_invalid(rng, context, args)
  [nil, "not cidr", "invalid", [], {}].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



126
127
128
129
130
131
# File 'lib/synthra/types/technology_internet/networking.rb', line 126

def generate_random(rng, context, args)
  # Generate IPv6 with CIDR notation
  ipv6 = TechnologyInternet::Ipv6.new.generate_random(rng, context, {})
  cidr = rng.int(64, 128) # Common IPv6 CIDR ranges
  "#{ipv6}/#{cidr}"
end