-
Notifications
You must be signed in to change notification settings - Fork 44
Support dot-separated addresses #1
Conversation
|
please rebase |
|
@resmo |
| if DEBUG: | ||
| log('%s is not a number' % part) | ||
| self.handle_self(qname) | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep this code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doqnach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regex suggestion
src/nip.py
Outdated
| subdomain = qname[0:qname.find(self.domain) - 1] | ||
| # Split foo.bar.10-0-0-1 in parts | ||
| subdomain_parts = subdomain.split('.') | ||
| match = re.findall('^(?:.+\.)?(\d{1,3}[-.]\d{1,3}[-.]\d{1,3}[-.]\d{1,3})$', subdomain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest supporting either - or . but not both at the same time. This could be done using back-references: ^(?:.+\.)?(\d{1,3}([-.])\d{1,3}\2\d{1,3}\2\d{1,3})$ https://regex101.com/r/Tamzd5/2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Doqnach would you like to pick it up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to, but I will be very honest in saying that I have no idea how to and neither do I have any way of testing the change before creating a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match eather `-` or `.` but not both at the same time.
|
Thank you for your comments. |
|
Thanks! |
|
Thank you! |
This PR adds supports of dot-separated addresses like xip.io.