-
Notifications
You must be signed in to change notification settings - Fork 217
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
#439 HTTP_bind_by_NIC_interfacename #442
base: main
Are you sure you want to change the base?
Conversation
G-Ork
commented
Jun 21, 2020
- Delegate address resolving to an global service
- Added service for RegEx matching on IPs
- Added service for RegEx matching on interface names
- Extend DocBook for jvm-agent config
- Delegate address resolving to an global service - Added service for RegEx matching on IPs - Added service for RegEx matching on interface names - Extend DocBook for jvm-agent config
Thanks a lot for your contribution ! I have a busy week ahead but will reserve some time on Friday to work integrate the PR (and also think about what todo with Java 6 support) have a nice week ... |
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.
Thanks again, looks nice !
I have some suggestions, see below. Especially wrt to naming the variable I would fold everything into the already existing host
config key.
* Optional wich isn't available in Java 6. | ||
* @throws RuntimeException If the configuration is invalid. | ||
*/ | ||
public AtomicReference<InetAddress> optain(Map<String, String> agentConfig) throws RuntimeException; |
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.
Typo (obtain instead of optain). But please rename to something like "extractAddress" or so (fits better to the existing naming scheme)
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.
No need to declare that it throws a RuntimeException.
* Konstructor | ||
*/ | ||
public DelegatingAddressConfigService() { | ||
super(); |
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.
No needed.
public DelegatingAddressConfigService() { | ||
super(); | ||
|
||
this.services = Collections.unmodifiableList(Arrays.asList(new AddressConfigService[] { |
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.
You don't need to create an array, just use the varadic form of asList
.
AtomicReference<InetAddress> ref = service.optain(agentConfig); | ||
|
||
if ( null != ref) { | ||
this.address = ref.get(); |
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.
you should throw an error when no address could be detected (like before).
Btw, I wouldn't mind to inline the DelegatingAdressConfigService() here (i.e. iterate directly over the the various address resolvers), to skip one level of abstraction and also make clear that there is always a default value for the address. (i..e effectively ref
can't be null, but that's not clear from the call)
</td> | ||
<td> | ||
<constant>localhost</constant> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td><constant>ipmatch</constant></td> |
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 wonder whether we could avoid to a new configuration key like nicmatch
or ipmatch
and fold everything into the existing host
variable. This approach would have multiple advantages:
- Multiple config-clashes would be avoided automatically
- Don't blow up the already huge configuration surface
So my suggestion would be to introduce multiples prefix like nic:
or ip:
which then trigger the different modes. Maybe even better just a match:
if from the value it could be determined whether its a mac or an IP (by the existence of a :
in the value ?)
Wdyt ?
Hi thanks for the review and your feedback. I've stubled over many of the topics you suggested during the implementation. I don't mind to consider your suggestion. It would be alot easier to reuse the existing key. A prefix would be the best workaround to extend the matching without conflict with the old style dots in ip matching and the RegEx dots in the alternative matching options. Did you see a need for supporting to classify ipv4 or ipv6? For myself I decided it for the whole JVM. So I don't need a config key to only bind ipv4. I would extend the documentation by a table with examples. This should be clearly to understand. I try to change it next week. |