Skip to content

Commit

Permalink
Will not connect user who has exceeded usage
Browse files Browse the repository at this point in the history
  • Loading branch information
bennjii committed Oct 19, 2022
1 parent 9ee1ff8 commit e192f60
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/components/reseda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ class WireGuard extends Component<{ file_path: string, user: any }> {
totalUp += parseInt(e.up);
});

return {totalDown, totalUp};

console.log(totalDown, totalUp);
}

Expand Down Expand Up @@ -490,6 +492,25 @@ class WireGuard extends Component<{ file_path: string, user: any }> {
}

connect(location: Server, callback_time: Function) {
// If user has exceeded limits, do not allow them to connect.
if(this.state.tier == "FREE" || this.state.tier == "SUPPORTER") {
const limits = this.determineLimits();

if(this.state.tier == "FREE") {
const limit = 5000000000;

if(limits.totalDown >= limit || limits.totalUp >= limit) {
return;
}
}else {
const limit = 50000000000;

if(limits.totalDown >= limit || limits.totalUp >= limit) {
return;
}
}
}

console.time("start->sendws");
callback_time(new Date().getTime());
console.log(this.config.keys);
Expand Down

0 comments on commit e192f60

Please sign in to comment.