Module:Sensitive IP addresses/API: Difference between revisions

Content deleted Content added
dump a bunch of code to test this and Module:IP: some of the code, after refactoring, would be useful for this module; see talk page for test results
make the response more similar to the MediaWiki Action API
Line 57:
--
-- {
-- ipssensitiveips = {
-- ips = {
-- ip = '1.2.3.4',{
-- [' ip-version'] = 'IPv41.2.3.4',
-- ['matchesip-rangeversion'] = '1.2.3.0/24IPv4',
-- ['entitymatches-idrange'] = 'entityid1.2.3.0/24',
-- } ['entity-id'] = 'entityid'
-- },
-- ranges = {
-- {
-- range = '4.5.6.0/24',
-- ['ip-version'] = 'IPv4',
-- ['matches-range'] = '4.5.0.0/16',
-- ['entity-id'] = 'entityid'
-- }
-- },
-- ['matched-ranges'] = {
-- {
-- range = '1.2.3.0/24',
-- ['ip-version'] = 'IPv4',
-- ['entity-id'] = 'entityid'
-- },
-- ranges = {
-- range = '4.5.0.0/16',{
-- ['ip-version'] range = 'IPv44.5.6.0/24',
-- ['entityip-idversion'] = 'entityidIPv4',
-- } ['matches-range'] = '4.5.0.0/16',
-- ['entity-id'] = 'entityid'
-- },
-- entities = { }
-- {},
-- id['matched-ranges'] = 'entityid',{
-- name = 'The entity name',{
-- description = 'A description ofrange the= entity'1.2.3.0/24',
-- ['ipv4ip-rangesversion'] = {'IPv4',
-- ['1.2.3.0/24entity-id'] = 'entityid',
-- '4.5.0.0/16'
-- '6.7.0.0/16'
-- },
-- ['ipv6-ranges'] = {
-- range = '2001:db8::ff00:12:4.5.0.0/11216',
-- } ['ip-version'] = 'IPv4',
-- notes = 'Notes about the ['entity-id'] or= its ranges'entityid'
-- }
-- {},
-- entities = {
-- {
-- ['ip-version'] id = 'IPv4entityid',
-- name = 'The entity name',
-- description = 'A description of the entity',
-- ['ipipv4-versionranges'] = 'IPv4',{
-- range = '41.52.63.0/24',
-- ['matches-range'] = '4.5.0.0/16',
-- range = '16.27.30.0/2416',
-- ['entity-id'] = 'entityid' },
-- ['matchedipv6-ranges'] = {
-- '6.7.0.2001:db8::ff00:12:0/16112'
-- '4.5.0.0/16'},
-- notes = 'Notes about the entity or its ranges'
-- },
-- }
-- },
-- }
--
-- Response with errors:
--
-- {
-- rangeserror = {
-- code = 'example-error',
-- info = 'There was an error',
-- ['*'] = 'See https://en.wikipedia.org/wiki/Module:Sensitive_IP_addresses for API usage'
-- }
-- }