Coder Social home page Coder Social logo

Limit speed connection about portforwarder HOT 9 CLOSED

malikshi avatar malikshi commented on May 18, 2024
Limit speed connection

from portforwarder.

Comments (9)

HirbodBehnam avatar HirbodBehnam commented on May 18, 2024

Hello
I don't know how to do it...

from portforwarder.

malikshi avatar malikshi commented on May 18, 2024

I'm using trickle to do that.

from portforwarder.

HirbodBehnam avatar HirbodBehnam commented on May 18, 2024

Quota is the max bytes which user can use to transmit data.

from portforwarder.

malikshi avatar malikshi commented on May 18, 2024

Quota is the max bytes which user can use to transmit data.

yes, it's can be set for max bandwidth/quota server. btw trickle didn't work for limiting speed.

from portforwarder.

malikshi avatar malikshi commented on May 18, 2024

@HirbodBehnam traffic quota doesn't seem to work? I set 3TB in configuration, then this 2 weeks checking vnstat 1.5TB total, do cat /etc/PortForwarder/config.json the quota remaining 2.5TB?

from portforwarder.

HirbodBehnam avatar HirbodBehnam commented on May 18, 2024

I think it should work fine. It's using the std io.Copy to copy the buffers and return the transferred amount of traffic. This happens at these two lines:

PortForwarder/main.go

Lines 271 to 275 in aa86187

if EnableTimeOut {
r, err = copyBuffer(dest, src)
} else {
r, err = io.Copy(dest, src) // if timeout is not enabled just use the original io.copy
}

PortForwarder/main.go

Lines 291 to 293 in aa86187

Rules.mu.Lock() // lock to change the amount of data transferred
Rules.Rules[index].Quota -= r
Rules.mu.Unlock()

from portforwarder.

malikshi avatar malikshi commented on May 18, 2024

current config, original quota set 3TB

{
  "SaveDuration":600,
  "Timeout":300,
  "Rules":[
    {
      "Name":"443",
      "Listen":443,
      "Forward":"a.b.c.d:443",
      "Quota":2436127916565,
      "ExpireDate":0,
      "Simultaneous":0
    }
  ]
}

running command
/usr/local/bin/PortForwarder --config config.json --verbose 0

is there any issues with this configuration? @HirbodBehnam.

from portforwarder.

HirbodBehnam avatar HirbodBehnam commented on May 18, 2024

No I think it's fine

from portforwarder.

HirbodBehnam avatar HirbodBehnam commented on May 18, 2024

I'm closing this due to inactivity. I still think It's fine.

from portforwarder.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.