Site DB #25
Aliases: Site DB, sitedb, site, db
8 verbs · 32 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
find* _only* _every* | this none this | rxd | #25 | 1 |
add | this none this | rxd | #25 | 40 |
load | this none this | rxd | #25 | 28 |
domain_literal | this none this | rxd | #25 | 17 |
init_for_core | this none this | rxd | #25 | 5 |
prune | this none this | rxd | #25 | 43 |
report_prune_progress | this none this | rxd | #25 | 24 |
prune_fixup | this none this | rxd | #25 | 26 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
domain | #25 | r | #36 | "centrac.org" |
prune_progress | #25 | rc | #36 | "rei.ee" |
prune_stop | #25 | rc | #36 | 254 |
total_pruned_people | #25 | rc | #36 | 51021 |
total_pruned_sites | #25 | rc | #36 | 28719 |
prune_task | #25 | rc | #36 | 1012403705 |
o | #25 | | #36 | list of 4{"", "", {"omahne.spcsdns.net", "org"}, {{"ip-66-87-142-217", "ip-66-87-142-5", "ip-66-87-143-224", "ip-66-87-143-251", "ip-66-87-143-174", "ip-66-87-143-207", "ip-66-87-143-119", "ip-66-87-142-128", "ip-66-87-142-101", "ip-66-87-143-100", "ip-66-87-142-20", "ip-66-87-142-236", "ip-66-87-142-169", "ip-66-87-143-104", "ip-66-87-143-166", "ip-66-87-143-55", "ip-66-87-143-72", "ip-66-87-142-242", "ip-66-87-142-228", "ip-66-87-142-200", "ip-66-87-143-114", "ip-66-87-143-46", "ip-66-87-143-222", "ip-66-87-142-191"}, {"centrac"}}} |
i | #25 | | #36 | {"p-66-87-14", "23", {}, {}} |
ip-66-87-142 | #25 | | #36 | {"-", "12", {"ip-66-87-142-5.omahne.spcsdns.net"}, {{#2}}} |
ip-66-87-143 | #25 | | #36 | list of 4{"-", "21", {"ip-66-87-143-46.omahne.spcsdns.net", "ip-66-87-143-72.omahne.spcsdns.net", "ip-66-87-143-55.omahne.spcsdns.net"}, {{#2}, {#2}, {#2, #615}}} |
9 | #25 | | #36 | {"7-127-2", "5", {"97-127-225-155.dvnp.qwest.net", "97-127-210-220.dvnp.qwest.net"}, {{#2, #272, #196, #1028}, {#2, #196, #615}}} |
ip-66-87-143-2 | #25 | | #36 | {"", "2", {"ip-66-87-143-207.omahne.spcsdns.net", "ip-66-87-143-251.omahne.spcsdns.net"}, {{#196}, {#2}}} |
1 | #25 | | #36 | {"", "07", {}, {}} |
ip-66-87-143-1 | #25 | | #36 | {"", "01", {"ip-66-87-143-166.omahne.spcsdns.net", "ip-66-87-143-174.omahne.spcsdns.net"}, {{#615}, {#196}}} |
ip-66-87-142-1 | #25 | | #36 | list of 4{"", "", {"ip-66-87-142-191.omahne.spcsdns.net", "ip-66-87-142-169.omahne.spcsdns.net", "ip-66-87-142-101.omahne.spcsdns.net", "ip-66-87-142-128.omahne.spcsdns.net"}, {{#2, #272}, {#2, #557}, {#196}, {#196}}} |
10 | #25 | | #36 | {"4.235.", "6", {"104.235.99.56", "104.235.118.49", "104.235.77.228"}, {{#365}, {#365}, {#365}}} |
ip-66-87-142-2 | #25 | | #36 | list of 4{"", "0", {"ip-66-87-142-228.omahne.spcsdns.net", "ip-66-87-142-242.omahne.spcsdns.net", "ip-66-87-142-236.omahne.spcsdns.net", "ip-66-87-142-217.omahne.spcsdns.net"}, {{#615}, {#615, #2}, {#2, #557}, {#2}}} |
ip-66-87-143-10 | #25 | | #36 | {"", "", {"ip-66-87-143-104.omahne.spcsdns.net", "ip-66-87-143-100.omahne.spcsdns.net"}, {{#2}, {#196}}} |
17 | #25 | | #36 | {"", "4", {"173.239.199.58"}, {{#365}}} |
97-127-25 | #25 | | #36 | {"4-", "", {"97-127-254-201.dvnp.qwest.net", "97-127-254-10.dvnp.qwest.net"}, {{#2, #365, #393, #196}, {#2, #196}}} |
ip-66-87-142-20 | #25 | | #36 | {"", "", {"ip-66-87-142-200.omahne.spcsdns.net", "ip-66-87-142-20.omahne.spcsdns.net"}, {{#615}, {#196}}} |
ip-66-87-143-11 | #25 | | #36 | {"", "", {"ip-66-87-143-114.omahne.spcsdns.net", "ip-66-87-143-119.omahne.spcsdns.net"}, {{#615, #2}, {#2, #196}}} |
104.235.6 | #25 | | #36 | {"", "", {"104.235.69.51", "104.235.66.87"}, {{#365}, {#365}}} |
ip-66-87-143-22 | #25 | | #36 | {"", "", {"ip-66-87-143-222.omahne.spcsdns.net", "ip-66-87-143-224.omahne.spcsdns.net"}, {{#2}, {#196}}} |
174 | #25 | | #36 | {"-22-10", "", {"174-22-102-18.dvnp.qwest.net", "174-22-104-235.dvnp.qwest.net"}, {{#615, #2}, {#2, #196, #365, #557, #564, #615, #652, #653, #654}}} |
node_perms | #37 | rc | #36 | "" |
data | #37 | r | #36 | <clear> |
| #37 | | #36 | list of 4{"", "oi91", {"localhost.centrac.org", "65-103-81-203.dvnp.qwest.net", "spcsdns.net", "centrac.org", "net", "qwest.net", "dvnp.qwest.net"}, {{#2}, {#2, #615, #196, #659, #660, #365, #272, #557, #652}, {"omahne"}, {#2, #196, #272, "localhost"}, {"qwest", "spcsdns"}, {"dvnp"}, {"97-127-254-10", "97-127-254-201", "174-22-104-235", "174-22-102-18", "97-127-210-220", "65-103-81-203", "97-127-225-155"}}} |
key | #1 | c | #36 | <clear> |
aliases | #1 | rc | #36 | {"Site DB", "sitedb", "site", "db"} |
description | #1 | rc | #36 | {"This object holds a db of places from which players have connected (see `help $site_db').", "The site blacklist and the graylist live as well (see `help blacklist')."} |
object_size | #1 | r | #36 | {9080, -1090650497} |
Ancestry
Ancestors (nearest first): #37 Generic Database → #1 Root Class
Children: none
Call graph
Source
find* _only* _every*
Referenced by
none
Source
1return ((caller == this) || caller_perms().wizard) ? pass(@args) | E_PERM;
add
Referenced by
- #10:record_connection line 15:
$site_db:add - #25:load line 21:
this:add
Source
1":add(player,site)"; 2if (!caller_perms().wizard) 3return E_PERM; 4endif 5{who, domain} = args; 6if (this:domain_literal(domain)) 7"... just enter it..."; 8l = this:find_exact(domain); 9if (l == $failed_match) 10this:insert(domain, {who}); 11elseif (!(who in l)) 12this:insert(domain, setadd(l, who)); 13endif 14else 15"...an actual domain name; add player to list for that domain..."; 16"...then add domain itself to list for the next larger domain; repeat..."; 17"... Example: domain == foo.bar.edu: "; 18"... enter #who on foo.bar.edu list"; 19"... enter `foo' on bar.edu list"; 20"... enter `bar' on edu list"; 21if (!(dot = index(domain, "."))) 22dot = length(domain) + 1; 23domain = tostr(domain, ".", this.domain); 24endif 25prev = who; 26while ($failed_match == (l = this:find_exact(domain))) 27this:insert(domain, {prev}); 28if (dot) 29prev = domain[1..dot - 1]; 30domain = domain[dot + 1..$]; 31else 32return; 33endif 34dot = index(domain, "."); 35endwhile 36if (!(prev in l)) 37this:insert(domain, {@l, prev}); 38endif 39return; 40endif
load
Referenced by
none
Source
1":load([start]) -- reloads site_db with the connection places of all players."; 2"This routine calls suspend() if it runs out of time."; 3"WIZARDLY"; 4"...needs to be able to read .all_connect_places"; 5if (!$perm_utils:controls(caller_perms(), this)) 6return E_PERM; 7endif 8plist = players(); 9if (!args) 10this:clearall(); 11elseif (i = args[1] in plist) 12plist[1..i - 1] = {}; 13else 14return E_INVARG; 15endif 16for p in (plist) 17if (valid(p) && (is_player(p) && (!$object_utils:isa(p, $guest)))) 18"... player may be recycled or toaded during the suspend(),..."; 19"... guests login from everywhere..."; 20for c in (p.all_connect_places) 21this:add(p, c); 22if ($command_utils:running_out_of_time()) 23player:tell("...", p); 24suspend(0); 25endif 26endfor 27endif 28endfor
domain_literal
Referenced by
- #10:blacklisted line 9:
$site_db:domain_literal - #10:blacklist_add*_temp line 8:
$site_db:domain_literal - #10:blacklist_remove*_temp line 7:
$site_db:domain_literal - #10:blacklisted_temp line 15:
$site_db:domain_literal - #25:add line 6:
this:domain_literal - #57:@blacklist line 36:
$site_db:domain_literal
Source
1":domain_literal(string)"; 2" => true iff string is a domain literal (i.e., numeric IP address)."; 3if (10 <= (len = length(hnum = strsub(args[1], ".", "")))) 4return toint(hnum[1..9]) && toint(hnum[6..len]); 5else 6return toint(hnum); 7endif 8"SLEAZY CODE ALERT"; 9"... what I wanted to do was return toint(strsub(args[1],\".\",\"\"))"; 10"... but on a 32-bit machine, this has a 1 in 4294967296 chance of failing"; 11"... (e.g., on \"42.94.967.296\", though I'll grant this particular example"; 12"... entails some very strange subnetting on net 42, to say the least)."; 13"... So we do something that is guaranteed to work so long as internet"; 14"... addresses stay under 32 bits --- a while yet..."; 15""; 16"... As soon as we're sure match() is working, this will become a one-liner:"; 17return match(args[1], "[0-9]+%.[0-9]+%.[0-9]+%.[0-9]+");
init_for_core
Referenced by
none
Source
1if (caller_perms().wizard) 2pass(); 3this:clearall(); 4this.domain = "localdomain"; 5endif
prune
Referenced by
none
Source
1"Carefully loop through the db and delete items associated with !valid and !is_player objects. If that results in no objects remaining for a site, delete that site."; 2"Attempt to keep memory usage down by only asking for a small number of items at a time. Should probably have some arguments to control this."; 3"Another thing it should do is be clever about string typed items."; 4"Rewriting this to do numerics now."; 5if (!caller_perms().wizard) 6raise(E_PERM); 7endif 8this.prune_task = task_id(); 9probe = this.prune_progress; 10while (probe[1] <= this.prune_stop) 11probestring = tostr(probe[1], ".", probe[2], "."); 12for sitename in (z = this:find_all_keys(probestring)) 13items = this:find_exact(sitename); 14orig = items; 15for y in (items) 16if ((typeof(y) == OBJ) && ((!valid(y)) || (!is_player(y)))) 17items = setremove(items, y); 18endif 19$command_utils:suspend_if_needed(0); 20endfor 21if (!items) 22this:delete(sitename); 23this.total_pruned_sites = this.total_pruned_sites + 1; 24elseif (items == orig) 25else 26this:insert(sitename, items); 27this.total_pruned_people = (this.total_pruned_people + length(orig)) - length(items); 28endif 29$command_utils:suspend_if_needed(0); 30endfor 31if (probe[2] == 255) 32probe[1] = probe[1] + 1; 33probe[2] = 0; 34else 35probe[2] = probe[2] + 1; 36endif 37this.prune_progress = probe; 38if ($command_utils:running_out_of_time()) 39set_task_perms($wiz_utils:random_wizard()); 40suspend(0); 41endif 42endwhile 43player:tell("Prune stopped at ", toliteral(this.prune_progress));
report_prune_progress
Referenced by
none
Source
1player:tell("Prune is up to ", toliteral(this.prune_progress), "."); 2mine = 0; 3if (typeof(this.prune_progress) == STR) 4total = (26 * 26) * 26; 5for x in [1..3] 6mine = ((mine * 26) + index($string_utils.alphabet, this.prune_progress[x])) - 1; 7endfor 8else 9total = 256 * 256; 10mine = (this.prune_progress[1] * 256) + this.prune_progress[2]; 11endif 12percent = (100.0 * tofloat(mine)) / tofloat(total); 13player:tell("We have processed ", mine, " entries out of ", total, ", or ", toint(percent), ".", toint(10.0 * percent) % 10, "%."); 14player:tell("There were ", this.total_pruned_people, " individual list entries removed, and ", this.total_pruned_sites, " whole sites removed."); 15if ($code_utils:task_valid(this.prune_task)) 16player:tell("Prune task is ", this.prune_task, ". Stacktrace:"); 17for x in (task_stack(this.prune_task, 1)) 18if (valid(x[4])) 19player:tell(x[4], ":", x[2], " [", x[1], "] ", x[3].name, " (", x[6], ")"); 20endif 21endfor 22else 23player:tell("The recorded task_id is no longer valid."); 24endif
prune_fixup
Referenced by
- #25:prune_fixup line 13:
this:prune_fixup
Source
1if (!caller_perms().wizard) 2raise(E_PERM); 3endif 4root = args[1]; 5items = this:find_exact(root); 6orig = items; 7if (items == #-3) 8return 1; 9endif 10$site_db.prune_progress = root; 11for item in (items) 12if (typeof(item) == STR) 13if (this:prune_fixup((item + ".") + root)) 14items = setremove(items, item); 15endif 16endif 17$command_utils:suspend_if_needed(0); 18endfor 19if (!items) 20this:delete(root); 21this.total_pruned_sites = this.total_pruned_sites + 1; 22return 1; 23elseif (orig == items) 24else 25this:insert(root, items); 26endif