Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyIp

Sample Java Spring Boot project for getting your external public Ip address.

Sometimes you need to know external ip address of your application, but it's hard to find out because application could be in docker, DMZ, virtual machine or behind NAT.

MyIpClient - is a Spring Component that allows you to determine your public ip behind all containers, vms and firewalls. It accesses external url: https://myip1.com/raw and get information about public as it sees you there.

If you want to use such a service in your application:

  1. include in pom.xml:
   <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-webflux</artifactId>
   </dependency>

   <dependency>
   <groupId>com.fasterxml.jackson.datatype</groupId>
   <artifactId>jackson-datatype-jsr310</artifactId>
   </dependency>
  1. Create Bean MyIpWebClient as in AppConfig.java

  2. Copy MyIpDTO, MyIpClient and MyIpClientImpl to your project.

  3. Use it anywhere you want:

    @Autowired private MyIpClient myIpClient;

https://myip1.com

Credits: https://myip1.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages