Skip to content

Commit

Permalink
fix name
Browse files Browse the repository at this point in the history
  • Loading branch information
sollhui committed Jul 5, 2022
1 parent 0e42329 commit 0c554d5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import javax.annotation.PostConstruct;

import com.alibaba.cloud.nacos.event.NacosDiscoveryInfoChangedEvent;
import com.alibaba.cloud.nacos.intetuntil.InetIPUtils;
import com.alibaba.cloud.nacos.intetuntil.InetIPv6Utils;
import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.PreservedMetadataKeys;
import com.alibaba.nacos.client.naming.utils.UtilAndComs;
Expand Down Expand Up @@ -214,7 +214,7 @@ public class NacosDiscoveryProperties {
private boolean failFast = true;

@Autowired
private InetIPUtils inetIPUtils;
private InetIPv6Utils inetIPUtils;

@Autowired
private InetUtils inetUtils;
Expand Down Expand Up @@ -326,7 +326,7 @@ public void setLogName(String logName) {
this.logName = logName;
}

public void setInetIPUtils(InetIPUtils inetIPUtils){
public void setInetIPUtils(InetIPv6Utils inetIPUtils){
this.inetIPUtils = inetIPUtils;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@

import java.io.Closeable;
import java.io.IOException;
import java.net.*;

import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;


public class InetIPUtils implements Closeable {
public class InetIPv6Utils implements Closeable {
private final ExecutorService executorService;

private final Log log = LogFactory.getLog(InetIPUtils.class);
private final Log log = LogFactory.getLog(InetIPv6Utils.class);

private final InetUtilsProperties properties;

public InetIPUtils(final InetUtilsProperties properties) {
public InetIPv6Utils(final InetUtilsProperties properties) {
this.properties = properties;
this.executorService = Executors.newSingleThreadExecutor((r) -> {
Thread thread = new Thread(r);
Expand All @@ -34,7 +42,7 @@ public void close() {
}

public InetUtils.HostInfo findFirstNonLoopbackHostInfo() {
InetAddress address = this.findFirstNonLoopbackAddress();
InetAddress address = this.findFirstNonLoopbackIPv6Address();
if (address != null) {
return this.convertAddress(address);
} else {
Expand All @@ -46,7 +54,7 @@ public InetUtils.HostInfo findFirstNonLoopbackHostInfo() {
}
}

public InetAddress findFirstNonLoopbackAddress() {
public InetAddress findFirstNonLoopbackIPv6Address() {
InetAddress address = null;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import org.springframework.context.annotation.Bean;

@EnableAutoConfiguration
public class UtilIPAutoConfiguration{
public UtilIPAutoConfiguration() {
public class UtilIPv6AutoConfiguration {
public UtilIPv6AutoConfiguration() {
}

@Bean
@ConditionalOnMissingBean
public InetIPUtils inetUtils(InetUtilsProperties properties) {
return new InetIPUtils(properties);
public InetIPv6Utils inetUtils(InetUtilsProperties properties) {
return new InetIPv6Utils(properties);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.alibaba.cloud.nacos.discovery.reactive.NacosReactiveDiscoveryClientConfiguration,\
com.alibaba.cloud.nacos.discovery.configclient.NacosConfigServerAutoConfiguration,\
com.alibaba.cloud.nacos.NacosServiceAutoConfiguration,\
com.alibaba.cloud.nacos.intetuntil.InetIPUtils
com.alibaba.cloud.nacos.intetuntil.InetIPv6Utils
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.alibaba.cloud.nacos.discovery.configclient.NacosDiscoveryClientConfigServiceBootstrapConfiguration
org.springframework.context.ApplicationListener=\
Expand Down

0 comments on commit 0c554d5

Please sign in to comment.