Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Adding the ability to add port range #11

Open
NabiKAZ opened this issue Jan 20, 2023 · 5 comments
Open

[Feature request] Adding the ability to add port range #11

NabiKAZ opened this issue Jan 20, 2023 · 5 comments

Comments

@NabiKAZ
Copy link

NabiKAZ commented Jan 20, 2023

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

@zmjack
Copy link
Owner

zmjack commented Jan 31, 2023

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.

@STaRDoGG
Copy link

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

https://github.com/STaRDoGG/PortProxyGUI

@blackwind
Copy link

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

@STaRDoGG
Copy link

STaRDoGG commented Sep 3, 2023

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.

@zmjack
Copy link
Owner

zmjack commented Sep 4, 2023

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.

  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants