IP Address Generator
This generator is responsible for generating random IP Address (v4) in a given range per each octet.
Configuration
Example
| const config: IPAddressConfig = {
octet1: { min: 10, max: 12 },
octet2: { min: 1, max: 32 },
octet3: { min: 1, max: 254 },
octet4: { min: 1, max: 254 },
};
|
Examples
| const config: IPAddressConfig = {
octet1: { min: 10, max: 12 },
octet2: { min: 1, max: 32 },
octet3: { min: 1, max: 254 },
octet4: { min: 1, max: 254 }
}
const generator = new IPAddressValueGenerator(config);
console.log(generator.generate());
|
| const config: IPAddressConfig = {
octet1: { min: 10, max: 12 },
octet2: { min: 1, max: 32 },
octet3: { min: 1, max: 254 },
octet4: { min: 1, max: 254 }
}
const generator = getValueGenerator('ip-address', config);
console.log(generator.generate());
|
| const schema: SchemaInput = {
fields: {
value: {
type: 'ip-address',
config: {
octet1: { min: 10, max: 12 },
octet2: { min: 1, max: 32 },
octet3: { min: 1, max: 254 },
octet4: { min: 1, max: 254 }
}
}
}
}
const fabricator = new Fabricator(schema);
console.log(fabricator.generate());
|
Output
{ value: '12.16.131.227' }