PortProxyGUI icon indicating copy to clipboard operation
PortProxyGUI copied to clipboard

[Feature request] Adding the ability to add port range

Open NabiKAZ opened this issue 2 years ago • 5 comments

Thanks for this project.

I suggest to work on port range registration. It seems that netsh does not support port range for this purpose.

I asked ChatGPT and it suggested a script that might be used in the project (:

Image:

image

NabiKAZ avatar Jan 20 '23 00:01 NabiKAZ

This suggestion will be included in the next version plan, but may not be updated in the near future.

You can follow this Issue to get notifications.

Thanks for your feedback.

zmjack avatar Jan 31 '23 10:01 zmjack

I created a fork that allows adding ranges; give it a shot if still interested.

https://github.com/STaRDoGG/PortProxyGUI

STaRDoGG avatar Jun 15 '23 08:06 STaRDoGG

Some fantastic work done there. Hope @STaRDoGG and @zmjack can collaborate to get this upstreamed.

blackwind avatar Sep 02 '23 22:09 blackwind

Some fantastic work done there. Hope @STaRDoGG and @zmjack can collaborate to get this upstreamed.

@blackwind our 2 projects are mutually exclusive (too many changes/additions in my repo to realistically merge the 2), but the port range feature is already in mine if you want to grab it.

STaRDoGG avatar Sep 03 '23 07:09 STaRDoGG

Thanks for waiting.


I looked at @STaRDoGG project and I think our goals are not the same.

It integrates more functions, but I want to be simpler.


It's worth pointing out that range rules are a necessary feature.

But we still have some unresolved issues.


We're creating a data structure ( Interval<T> ) for computing ranges, but it hasn't passed all the unit tests yet.

With this structure, we are able to convert single-point rules (from system) into range rules.

var ports = new[] { 5000, 5001, 5002, 6000, 6001 };
var portRanges = new Interval<int>{ ports };
portRanges.Dump();
Start End
5000 5002
6000 6001

Next, we can determine whether the rules set by the user have been fully covered.

var userRules = new Interval<int>
{
    (5000, 5001),
    (6000, 6002),
};

//TODO: optimizable
var results = 
    from userRule in userRules
    let covered = portRanges.Any(x => x.Start <= userRule.Start && userRule.End <= x.End)
    select new 
    {
        UserRule = userRule.ToString(),
        HasCovered = covered,
    };
results.Dump();
UserRule HasCovered
(5000, 5001) True
(6000, 6002) False

We also need to fix the following issues before releasing a new version.

  • [x] Determine whether the range rules set by the user have been fully covered.

  • [ ] Generate rules for uncovered ranges.

  • [ ] Combine multiple consecutive independent rules into range rules.

  • [ ] Split range rules into independent rules.

zmjack avatar Sep 04 '23 10:09 zmjack