[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-19 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744571#comment-17744571
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

cstamas merged PR #315:
URL: https://github.com/apache/maven-resolver/pull/315




> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Tamas Cservenak
>Priority: Major
> Fix For: 1.9.14
>
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-19 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744534#comment-17744534
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

cstamas commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1267887191


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,19 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);

Review Comment:
   Why would we do that? they are logically totally related... let me push some 
changes then, is really one liner.





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Tamas Cservenak
>Priority: Major
> Fix For: 1.9.14
>
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-19 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744531#comment-17744531
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

bmarwell commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1267884073


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,19 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);

Review Comment:
   Can this be added later? In another pr?





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Tamas Cservenak
>Priority: Major
> Fix For: 1.9.14
>
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-19 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744522#comment-17744522
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

cstamas commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1267875400


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,19 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);

Review Comment:
   I can envision some shop that may be "segmented" (network wise). Hence, this 
seems to me low hanging fruit to allow "route per remote repository", so why 
not?





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Tamas Cservenak
>Priority: Major
> Fix For: 1.9.14
>
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-19 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744521#comment-17744521
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

cstamas commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1267875400


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,19 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);

Review Comment:
   I can envision some show that may be "segmented" (network wise). Hence, this 
seems to me low hanging fruit to all o"route per remote repository", so why not?



##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,19 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);

Review Comment:
   I can envision some shop that may be "segmented" (network wise). Hence, this 
seems to me low hanging fruit to all o"route per remote repository", so why not?





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Tamas Cservenak
>Priority: Major
> Fix For: 1.9.14
>
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-13 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17742933#comment-17742933
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

bmarwell commented on PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#issuecomment-1634798587

   > Lgtm, but a nitpick: is Optional really needed?
   
   Of course not. I just find it easier to read and write, but YMMV and I can 
change it to sth like:
   
   ```
   if (bindAddress == null) {
 return null;
   }
   
   return this.resolveAddress(bindAddress);
   ```




> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Benjamin Marwell
>Priority: Major
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740128#comment-17740128
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

michael-o commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1252831609


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,20 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);
+return 
Optional.ofNullable(bindAddress).map(this::resolveAddress).orElse(null);
+}
+
+private InetAddress resolveAddress(String bindAddress) {
+try {
+return InetAddress.getByName(bindAddress);
+} catch (UnknownHostException uhe) {
+throw new IllegalArgumentException(
+"Given bind address (" + bindAddress + ") cannot be 
resolved. Reverting to default route.", uhe);

Review Comment:
   The message is not correct anymore





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Benjamin Marwell
>Priority: Major
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740061#comment-17740061
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

michael-o commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1252684740


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,20 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);
+return 
Optional.ofNullable(bindAddress).map(this::resolveAddressOrNull).orElse(null);
+}
+
+private InetAddress resolveAddressOrNull(String bindAddress) {

Review Comment:
   It is not null anymore...





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Benjamin Marwell
>Priority: Major
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740055#comment-17740055
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

bmarwell commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1252673255


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,20 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);
+return 
Optional.ofNullable(bindAddress).map(this::resolveAddressOrNull).orElse(null);
+}
+
+private InetAddress resolveAddressOrNull(String bindAddress) {
+try {
+return InetAddress.getByName(bindAddress);
+} catch (UnknownHostException uhe) {
+LOGGER.warn("Given bind address (" + bindAddress + ") cannot be 
resolved. Reverting to default route.");

Review Comment:
   Yes, that would be less surprising. I agree. Will change this, too. This 
also answers my question about the swallowed log message.





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Benjamin Marwell
>Priority: Major
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740054#comment-17740054
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

michael-o commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1252670683


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,20 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);
+return 
Optional.ofNullable(bindAddress).map(this::resolveAddressOrNull).orElse(null);
+}
+
+private InetAddress resolveAddressOrNull(String bindAddress) {
+try {
+return InetAddress.getByName(bindAddress);
+} catch (UnknownHostException uhe) {
+LOGGER.warn("Given bind address (" + bindAddress + ") cannot be 
resolved. Reverting to default route.");

Review Comment:
   Shouldn't this really fail with IAE? I mean, if you provide invalid values 
the system should fail no? If you want default, don't provide it.





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Benjamin Marwell
>Priority: Major
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740052#comment-17740052
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

bmarwell commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1252667551


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,20 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);
+return 
Optional.ofNullable(bindAddress).map(this::resolveAddressOrNull).orElse(null);
+}
+
+private InetAddress resolveAddressOrNull(String hostOrIp) {
+try {
+return InetAddress.getByName(hostOrIp);
+} catch (UnknownHostException uhe) {
+LOGGER.warn("Given bind host (" + hostOrIp + ") cannot be 
resolved. Reverting to default route.");

Review Comment:
   Thanks!
   I just saw I swallowed the UHE. Maybe add a debug logging?





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Benjamin Marwell
>Priority: Major
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740049#comment-17740049
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

michael-o commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1252657965


##
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##
@@ -295,6 +300,20 @@ final class HttpTransporter extends AbstractTransporter {
 this.client = builder.build();
 }
 
+private InetAddress getBindAddress(RepositorySystemSession session) {
+String bindAddress = ConfigUtils.getString(session, null, 
BIND_ADDRESS);
+return 
Optional.ofNullable(bindAddress).map(this::resolveAddressOrNull).orElse(null);
+}
+
+private InetAddress resolveAddressOrNull(String hostOrIp) {
+try {
+return InetAddress.getByName(hostOrIp);
+} catch (UnknownHostException uhe) {
+LOGGER.warn("Given bind host (" + hostOrIp + ") cannot be 
resolved. Reverting to default route.");

Review Comment:
   I'd use `address` throughout and consistently...





> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Benjamin Marwell
>Priority: Major
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MRESOLVER-382) Define local outgoing (bind) address

2023-07-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MRESOLVER-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740040#comment-17740040
 ] 

ASF GitHub Bot commented on MRESOLVER-382:
--

bmarwell opened a new pull request, #315:
URL: https://github.com/apache/maven-resolver/pull/315

   fixes MRESOLVER-382




> Define local outgoing (bind) address
> 
>
> Key: MRESOLVER-382
> URL: https://issues.apache.org/jira/browse/MRESOLVER-382
> Project: Maven Resolver
>  Issue Type: Improvement
>  Components: Resolver
>Reporter: Benjamin Marwell
>Assignee: Benjamin Marwell
>Priority: Major
>
> Currently, outgoing PUT connections (or download from central for that 
> matter) will be resolved over the default route.
> However, this is not always feasible.
>  h2. Expected behaviour
> A new property {{aether.connector.http.bind.address}} is defined for outgoing 
> requests, so that other routes (other interfaces) can be used.
> h2. Actual behaviour
> Certain systems cannot be reached when a firewall is only opened on a 
> non-default interface.
> h2. User Story
> Builds on servers with multiple interfaces: 
> * The default route is defined poorly
> * Other interfaces are available and have the requested firewall rules
> * User defines -Daether.connector.http.bind.address=${myotherip} (or local 
> address) to make outgoing connections to bind to another interface than the 
> default one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)