Commit Graph

41 Commits

Author SHA1 Message Date
Guangcong Luo
0143ae28dd Replace fs module (#3686)
The new FS module is an abstraction layer over the built-in fs module.

The main reason it exists is because I need an abstraction layer I can
disable writing from. But that'll be in another commit.

Currently, mine is better because:
 - paths are always relative to PS's base directory
 - Promises (seriously wtf Node Core what are you thinking)
 - PS-style API: FS("foo.txt").write("bar") for easier argument order
 - mkdirp

This also increases the minimum supported Node version from v6.0 to
v7.7, because we now use async/await. Sorry for the inconvenience!

This also drops the mock-fs-require-fix dependency

mock-fs-require-fix was always kind of a huge hack. It's no longer
necessary, with an FS API that does everything it used to.

This removes a lot of other hacks from test/main.js, which is nice.
2017-06-24 13:42:54 -07:00
Ben Davies
a58abab443 DNSBL: Typescript (#3614) 2017-06-11 23:07:56 -05:00
panpawn
a9c77372ed Standardize using const when declaring modules (#2806) 2016-10-01 21:40:05 -07:00
Guangcong Luo
0453a3d544 Improve dnsbl.js type comments
Nothing particularly consequential, just some changes that make it
play better with type checkers.

(I've been toying with flodoc but unfortunately it's not at a point
where it works particularly well...)
2016-09-28 22:13:07 -07:00
Guangcong Luo
7c45c2b348 Dnsbl: Update hardcoded IP ranges 2016-08-10 17:22:03 -05:00
Guangcong Luo
e82917fc95 Refactor/merge dnsbl.js and cidr.js
dnsbl.js is kind of a misnomer, but it has been for a long time. It's
currently a collection of various tools useful for IP-based blocking.

Maybe iptools.js?

Anyway, the two files are now one file, and have been refactored a
bit for performance. Dnsbl.query is also a Promise API now.
2016-08-10 15:00:46 -05:00
Guangcong Luo
088c23bd62 Refactor Dnsbl.reverse to use Promises 2016-08-07 21:08:18 -05:00
Guangcong Luo
cbdf68f148 Fix formatting error 2016-08-07 18:14:50 -05:00
Guangcong Luo
d41309f646 Add datacenters.csv proxy list to Dnsbl
We now use the datacenter list from https://github.com/client9/ipcat

It's incomplete so I've merged in PS's own list of datacenters, and
it looks like it's been unmaintained since March, but it's a pretty
good starting point.

(dnsbl.js has been a more general list of proxies for quite a while;
maybe I should look into renaming it...)
2016-08-07 18:53:26 -04:00
Guangcong Luo
e30361a573 Sync DNSBL known IP ranges 2016-08-06 19:21:11 -04:00
Guangcong Luo
10df047298 Sync DNSBL known IP ranges 2016-08-02 04:08:00 -04:00
Ivo Julca
22779102cc Lint: Add miscellaneous extra rules
Among the newly added rules, there are quite a few intended to enforce
compliance of CONTRIBUTING.md-blessed idioms, as well as ensure
safe usage of classes and constant bindings.

We are also now enforcing usage of early return in commands.js,
which has 100% compliance as of fd2c45c.
2016-04-25 21:52:21 -05:00
Guangcong Luo
3929aefe7b Sync DNSBL known IP ranges 2016-04-13 05:42:46 -04:00
Guangcong Luo
b665660608 Refactor for more ES6 features
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.

This refactor:

- uses arrow functions where appropriate

  Note that arrow functions still aren't used in Mocha, where `this`
  is sometimes meaningful.

  This also removes the need for .bind() nearly everywhere, as well
  as the `self = this` trick.

- refactors Validator and Connection into ES6 classes

- no longer uses Array#forEach for iterating arrays

  We strongly prefer for (let i = 0; i < arr.length; i++) because of
  performance reasons. Most forEaches have been replaced with for..of,
  though, which is 5x slower than the long-form loop but 2x faster
  than forEach, which is good enough outside of most inner loops.

  The only exception is tournaments, which is due for a more invasive
  refactor soon anyway.
2016-02-10 17:40:21 -06:00
Guangcong Luo
5bfdbf8bb2 Convert DNSBL cache to ES6 Maps 2015-12-10 10:57:59 -05:00
Ivo Julca
8619ba2022 Turn on strict mode globally for real 2015-11-08 15:38:15 -05:00
Ivo Julca
7dddb66253 Migrate build system to ESLint
JSHint's ES6 support is shaky, and its development has stalled as of late.
Since ESLint can do by itself both JSHint and JSCS' jobs, this commit replaces them.
Gulp and its related dependencies are also hereby removed.
2015-11-07 21:36:49 -05:00
Juanma Serrano
c4ac8d6e2f Use strict mode and let and const instead of var
This commit also fixes some duplicated variable declarations.
2015-11-06 21:56:52 -05:00
Konrad Borowski
3b02acb22e DNSBL: Add Ultrasurf proxy service 2015-10-30 20:30:23 +01:00
Guangcong Luo
3c9a3a29ba Refactor Dnsbl.reverse
This renames exports to Dnsbl for ease of hotpatching.
2015-06-23 23:14:58 -04:00
Guangcong Luo
93db8d50eb Sync nohost list 2015-06-23 23:14:58 -04:00
Guangcong Luo
a604251d81 Sync .nohost list
We now use .proxy-nohost and .mobile-nohost so it's easier to block
proxies.
2015-06-16 19:12:21 -04:00
Guangcong Luo
181a0481da Sync .nohost list 2015-06-06 14:03:10 -04:00
Guangcong Luo
eb9524522f Fix Travis error in DNSBL 2015-05-27 15:39:27 -04:00
Guangcong Luo
779fa27338 DNSBL: Update Zenmate nohost listing 2015-05-27 14:37:17 -04:00
Guangcong Luo
b2738047c6 Update .nohost list for DigitalOcean 2015-05-15 17:25:28 -04:00
Guangcong Luo
e49274a0f7 DNSBL: Update nohost listings 2015-04-29 00:07:25 -04:00
Guangcong Luo
313b86c400 Update DNS reverse database 2015-03-20 00:26:38 -04:00
Guangcong Luo
ea76b84b37 Fill in fake hosts for IP ranges with no host
Reverse DNS can't always find a host for certain common IP
ranges (generally cell networks), so we're going to fill in
a fake host in that case, to make rangebans and the like
easier.
2015-03-14 19:13:17 -04:00
Guangcong Luo
12b673bb49 Fix style errors; update gulpfile
I used a hack to make the multiple declaration errors go away,
so all that remained in jsHint were actual errors, which I've
now mostly fixed.

All this linting ended up uncovering one actual bug: Uproar's
message not showing. It's a very minor bug in a move no one uses,
so I'm going to fold it into this commit.
2014-08-10 18:06:44 -04:00
Slayer95
328eb85775 Add command /lockdetails to check if a locked IP is in a DNSBL 2014-07-11 03:43:35 -05:00
小太
5c8fc7b982 Space after function for anonymous functions 2014-04-22 01:58:16 +10:00
小太
6fb3bc332a Spaces around operators and === instead of == 2014-04-22 01:56:11 +10:00
Tyler Stark
afb3dc0c09 First pass at code quality: adding semicolons. 2014-02-09 20:35:42 -06:00
Guangcong Luo
3e5274f145 Don't check DNSBLs for localhost 2013-11-02 22:12:46 -07:00
Guangcong Luo
8585f0a11e Make the list of blocklists a const 2013-09-14 11:19:11 -07:00
Guangcong Luo
cb8baab555 Documentation for dnsbl.js 2013-09-14 10:50:20 -07:00
Guangcong Luo
8b1c4a59d9 Extend dnsbl.js to support multiple blocklists 2013-09-14 10:40:35 -07:00
Guangcong Luo
de7d5310e2 IPs listed on Spamhaus's SBL are now locked rather than banned. 2013-09-14 09:12:33 -07:00
Guangcong Luo
1e71ec6184 Cache DNSBL results 2013-09-13 10:19:00 -07:00
Guangcong Luo
d92035acdf Support Spamhaus DNSBL
Now, by default, any IP on the Spamhaus DNSBL list will be automatically
banned.
2013-09-13 10:13:35 -07:00