mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 10:35:40 +08:00
countall / nocountall ssupport added
This commit is contained in:
parent
cc6ec2445c
commit
d0725163d1
11
src/auth.c
11
src/auth.c
@ -605,10 +605,13 @@ void trafcountfunc(struct clientparam *param){
|
|||||||
for(tc = conf.trafcounter; tc; tc = tc->next) {
|
for(tc = conf.trafcounter; tc; tc = tc->next) {
|
||||||
if(ACLmatches(tc->ace, param)){
|
if(ACLmatches(tc->ace, param)){
|
||||||
time_t t;
|
time_t t;
|
||||||
if(tc->ace->action == NOCOUNTIN) break;
|
if(tc->ace->action == NOCOUNTIN || tc->ace->action == NOCOUNTALL) {
|
||||||
|
countout = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(tc->ace->action != COUNTIN) {
|
if(tc->ace->action != COUNTIN) {
|
||||||
countout = 1;
|
countout = 1;
|
||||||
continue;
|
if(tc->ace->action != COUNTALL)continue;
|
||||||
}
|
}
|
||||||
tc->traf64 += param->statssrv64;
|
tc->traf64 += param->statssrv64;
|
||||||
time(&t);
|
time(&t);
|
||||||
@ -618,8 +621,8 @@ void trafcountfunc(struct clientparam *param){
|
|||||||
if(countout) for(tc = conf.trafcounter; tc; tc = tc->next) {
|
if(countout) for(tc = conf.trafcounter; tc; tc = tc->next) {
|
||||||
if(ACLmatches(tc->ace, param)){
|
if(ACLmatches(tc->ace, param)){
|
||||||
time_t t;
|
time_t t;
|
||||||
if(tc->ace->action == NOCOUNTOUT) break;
|
if(tc->ace->action == NOCOUNTOUT || tc->ace->action == NOCOUNTALL) break;
|
||||||
if(tc->ace->action != COUNTOUT) {
|
if(tc->ace->action != COUNTOUT && tc->ace->action != COUNTALL ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tc->traf64 += param->statscli64;
|
tc->traf64 += param->statscli64;
|
||||||
|
11
src/conf.c
11
src/conf.c
@ -1113,6 +1113,13 @@ static int h_ace(int argc, unsigned char **argv){
|
|||||||
else if(!strcmp((char *)argv[0], "nocountout")){
|
else if(!strcmp((char *)argv[0], "nocountout")){
|
||||||
res = NOCOUNTOUT;
|
res = NOCOUNTOUT;
|
||||||
}
|
}
|
||||||
|
else if(!strcmp((char *)argv[0], "countall")){
|
||||||
|
res = COUNTALL;
|
||||||
|
offset = 3;
|
||||||
|
}
|
||||||
|
else if(!strcmp((char *)argv[0], "nocountall")){
|
||||||
|
res = NOCOUNTALL;
|
||||||
|
}
|
||||||
else if(!strcmp((char *)argv[0], "connlim")){
|
else if(!strcmp((char *)argv[0], "connlim")){
|
||||||
res = CONNLIM;
|
res = CONNLIM;
|
||||||
offset = 2;
|
offset = 2;
|
||||||
@ -1224,6 +1231,8 @@ static int h_ace(int argc, unsigned char **argv){
|
|||||||
case NOCOUNTIN:
|
case NOCOUNTIN:
|
||||||
case COUNTOUT:
|
case COUNTOUT:
|
||||||
case NOCOUNTOUT:
|
case NOCOUNTOUT:
|
||||||
|
case COUNTALL:
|
||||||
|
case NOCOUNTALL:
|
||||||
tl = myalloc(sizeof(struct trafcount));
|
tl = myalloc(sizeof(struct trafcount));
|
||||||
if(!tl) {
|
if(!tl) {
|
||||||
fprintf(stderr, "No memory to create traffic limit filter\n");
|
fprintf(stderr, "No memory to create traffic limit filter\n");
|
||||||
@ -1232,7 +1241,7 @@ static int h_ace(int argc, unsigned char **argv){
|
|||||||
memset(tl, 0, sizeof(struct trafcount));
|
memset(tl, 0, sizeof(struct trafcount));
|
||||||
tl->ace = acl;
|
tl->ace = acl;
|
||||||
|
|
||||||
if((acl->action == COUNTIN)||(acl->action == COUNTOUT)) {
|
if((acl->action == COUNTIN)||(acl->action == COUNTOUT)||(acl->action == COUNTALL)) {
|
||||||
unsigned long lim;
|
unsigned long lim;
|
||||||
|
|
||||||
tl->comment = ( char *)argv[1];
|
tl->comment = ( char *)argv[1];
|
||||||
|
@ -384,6 +384,10 @@ static void * ef_ace_type(struct node * node){
|
|||||||
return "countout";
|
return "countout";
|
||||||
case NOCOUNTOUT:
|
case NOCOUNTOUT:
|
||||||
return "nocountout";
|
return "nocountout";
|
||||||
|
case COUNTALL:
|
||||||
|
return "countall";
|
||||||
|
case NOCOUNTALL:
|
||||||
|
return "nocountall";
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,8 @@ int
|
|||||||
#define NOCOUNTOUT 8
|
#define NOCOUNTOUT 8
|
||||||
#define CONNLIM 9
|
#define CONNLIM 9
|
||||||
#define NOCONNLIM 10
|
#define NOCONNLIM 10
|
||||||
|
#define COUNTALL 11
|
||||||
|
#define NOCOUNTALL 12
|
||||||
|
|
||||||
#define CONNECT 0x00000001
|
#define CONNECT 0x00000001
|
||||||
#define BIND 0x00000002
|
#define BIND 0x00000002
|
||||||
|
Loading…
Reference in New Issue
Block a user