-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from armzilla/development
Development
- Loading branch information
Showing
9 changed files
with
118 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.armzilla.ha; | ||
|
||
import org.springframework.beans.factory.InitializingBean; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Created by arm on 9/16/16. | ||
*/ | ||
@Component | ||
public class ConfigChecker implements InitializingBean { | ||
|
||
@Value("${upnp.config.address}") | ||
private String responseAddress; | ||
|
||
@Override | ||
public void afterPropertiesSet() throws Exception { | ||
if(responseAddress == null || responseAddress.isEmpty() ){ | ||
throw new IllegalArgumentException("please provide the IP(v4) address of the interface you want the bridge to listen on using --upnp.config.address=<ipadress>"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.armzilla.ha; | ||
|
||
import org.apache.catalina.connector.Connector; | ||
import org.apache.coyote.http11.Http11NioProtocol; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; | ||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* Created by arm on 9/12/15. | ||
*/ | ||
@Component | ||
|
||
public class TomcatConnectorBean { | ||
@Value("${emulator.portbase}") | ||
private int portBase; | ||
@Value("${emulator.portcount}") | ||
private int portCount; | ||
@Bean | ||
public EmbeddedServletContainerFactory servletContainer() { | ||
TomcatEmbeddedServletContainerFactory tomcat = null; | ||
for(int i = 0; i < portCount; i ++) { | ||
if(tomcat == null){ | ||
tomcat = new TomcatEmbeddedServletContainerFactory(portBase + i); | ||
}else{ | ||
tomcat.addAdditionalTomcatConnectors(createConnector(portBase + i)); | ||
} | ||
} | ||
return tomcat; | ||
} | ||
|
||
private Connector createConnector(int portNumber) { | ||
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); | ||
Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); | ||
connector.setScheme("http"); | ||
connector.setPort(portNumber); | ||
return connector; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
upnp.response.port=50000 | ||
server.port=8080 | ||
upnp.config.address=192.168.1.1 | ||
upnp.config.address= | ||
emulator.portbase=8080 | ||
emulator.portcount=3 | ||
upnp.disable=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
upnp.response.port=50000 | ||
upnp.config.address=192.168.1.1 | ||
emulator.portbase=8080 | ||
emulator.portcount=3 | ||
upnp.disable=false |