Skip to content

Commit fba5ce7

Browse files
committed
add readme. set default value on error for override limit to global limit
1 parent a463d64 commit fba5ce7

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Altimeter
2+
3+
### [Discord](https://discord.gg/eeZbM9umBy)
4+
5+
Sponge API 7.3.x Plugin that limits the number of accounts that can connect from an IP address
6+
7+
##The gist
8+
A list exists per IP, each list can hold up to X accounts and each account will be removed from the queue until the TTL expires.
9+
If the list fills for that IP, no more accounts can be logged in from that IP.
10+
11+
## Definitions
12+
* TTL: `Time to live`
13+
14+
## Commands
15+
* `/altimeter`: lists sub commands
16+
* `/altimeter clear [all|x.x.x.x]`: clear the all account list, or the account list associated with a given IP address (v4/v6)
17+
* `/altimeter override x.x.x.x <limit>`: set account limit for `x.x.x.x` to `limit`
18+
19+
## Permissions
20+
* `altimeter.override`
21+
* `altimeter.clear.ip`
22+
* `altimeter.clear.all`
23+
24+
## Configuration
25+
```
26+
altimeter {
27+
# How many accounts from one IP can log in.
28+
accountLimit=5
29+
# How often accounts should be checked and cleared from IP lists.
30+
checkInterval {
31+
# DAYS, HOURS, MINUTES, or SECONDS
32+
unit=MINUTES
33+
value=5
34+
}
35+
# Override account limit for specific IPs
36+
limitOverrides=[
37+
{
38+
ip="127.0.0.1"
39+
limit=5
40+
}
41+
]
42+
# How long after an account is added to the queue is it removed.
43+
ttl {
44+
# DAYS, HOURS, MINUTES, or SECONDS
45+
unit=DAYS
46+
value=30
47+
}
48+
}
49+
```

src/main/java/tv/voidstar/altimeter/AltimeterConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ public static void load() {
9898
Altimeter.getLogger().info("load limit overrides data");
9999
for (ConfigurationNode overrideNode : limitOverridesNode.getChildrenList()) {
100100
String ip = overrideNode.getNode("ip").getString("in.va.li.d");
101+
int limit = overrideNode.getNode("limit").getInt(accountLimit);
101102
if (InetAddresses.isInetAddress(ip)) {
102-
accountLimitOverrides.put(ip, overrideNode.getNode("limit").getInt(5));
103-
Altimeter.getLogger().info("{} has {} account limit", ip, overrideNode.getNode("limit").getInt(5));
103+
accountLimitOverrides.put(ip, limit);
104+
Altimeter.getLogger().info("{} has {} account limit", ip, limit);
104105
} else {
105106
Altimeter.getLogger().error("Invalid IP in limitOverrides configuration {}", ip);
106107
}

0 commit comments

Comments
 (0)