Refine search
public String getMgmtAddress() { return NetworkUtils.formatPossibleIpv6Address(mgmtAddress); }
private String getAddressAsString(InetSocketAddress address) { if (address == null) { return "None"; } return NetworkUtils.formatAddress(address); }
if (server.getOutgoingSocketBinding() != null) { InetSocketAddress socketAddress = getServerSocketAddress(server); if (socketAddress.getAddress() == null) { MailLogger.ROOT_LOGGER.hostUnknown(socketAddress.getHostName()); props.setProperty(getHostKey(protocol), NetworkUtils.canonize(socketAddress.getHostName())); } else { props.setProperty(getHostKey(protocol), NetworkUtils.canonize(socketAddress.getAddress().getHostName())); props.setProperty(getPortKey(protocol), String.valueOf(socketAddress.getPort()));
host = NetworkUtils.canonize(clientMapping.getDestinationAddress()); port = clientMapping.getDestinationPort(); port = sa.getPort(); if (sa.getAddress().isLoopbackAddress()) { host = NetworkUtils.canonize(sa.getAddress().getHostName()); } else { host = NetworkUtils.canonize(sa.getAddress().getHostAddress()); OutboundSocketBinding binding = outboundSocketBindings.get(name).get(); port = binding.getDestinationPort(); host = NetworkUtils.canonize(binding.getUnresolvedDestinationAddress()); if (binding.getSourceAddress() != null) { tc.getParams().put(TransportConstants.LOCAL_ADDRESS_PROP_NAME, NetworkUtils.canonize(binding.getSourceAddress().getHostAddress()));
hostname = NetworkUtils.formatPossibleIpv6Address(InetAddress.getByName(hostname).getHostAddress()); } catch (UnknownHostException ex) { String message = "Cannot resolve host address: " + hostname + " , error : " + ex.getMessage();
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final ServiceController<?> controller = context.getServiceRegistry(false).getService(NetworkInterfaceService.JBOSS_NETWORK_INTERFACE.append(interfaceName)); if(controller != null && controller.getState() == ServiceController.State.UP) { final NetworkInterfaceBinding binding = NetworkInterfaceBinding.class.cast(controller.getValue()); final InetAddress address = binding.getAddress(); final ModelNode result = new ModelNode(); if(RESOLVED_ADDRESS.getName().equals(attributeName)) { result.set(NetworkUtils.canonize(address.getHostAddress())); } context.getResult().set(result); } context.stepCompleted(); } }, OperationContext.Stage.RUNTIME);
@Override void execute(final ModelNode operation, final SocketBinding binding, final ModelNode result) { ManagedBinding managedBinding = binding.getManagedBinding(); if (managedBinding != null) { InetAddress addr = managedBinding.getBindAddress().getAddress(); result.set(NetworkUtils.canonize(addr.getHostAddress())); } }
@Override public void execute(ManagedServer server) throws Exception { assert Thread.holdsLock(ManagedServer.this); // Call under lock // Reconnect final String hostName = InetAddress.getByName(managementSocket.getHostName()).getHostName(); final int port = managementSocket.getPort(); processControllerClient.reconnectProcess(serverProcessName, NetworkUtils.formatPossibleIpv6Address(hostName), port, bootConfiguration.isManagementSubsystemEndpoint(), authKey); } }
/** * Converts socket address into string literal, which has form: 'address:port'. Example:<br> * <ul> * <li>127.0.0.1:8080</li> * <li>dns.name.com:8080</li> * <li>[0fe:1::20]:8080</li> * <li>[::1]:8080</li> * </ul> * @param inet * @return */ public static String formatAddress(InetSocketAddress inet){ if(inet == null){ throw new NullPointerException(); } StringBuilder result = new StringBuilder(); if(inet.isUnresolved()){ result.append(inet.getHostName()); }else{ result.append(formatPossibleIpv6Address(formatAddress(inet.getAddress()))); } result.append(":").append(inet.getPort()); return result.toString(); }
/** * Formats input address. For IPV4 returns simply host address, for IPV6 formats address according to <a * href="http://tools.ietf.org/html/rfc5952">RFC5952</a> rules. It does not embed IPV6 address in '[', ']', since those are part of IPV6 URI literal. * * @param inet * @return */ public static String formatAddress(InetAddress inet){ if(inet == null){ throw new NullPointerException(); } if(inet instanceof Inet4Address){ return inet.getHostAddress(); } else if (inet instanceof Inet6Address){ byte[] byteRepresentation = inet.getAddress(); int[] hexRepresentation = new int[IPV6_LEN]; for(int i=0;i < hexRepresentation.length;i++){ hexRepresentation[i] = ( byteRepresentation[2*i] & 0xFF) << 8 | ( byteRepresentation[2*i+1] & 0xFF ); } compactLongestZeroSequence(hexRepresentation); return formatAddress6(hexRepresentation); } else { return inet.getHostAddress(); } }
qualifiedHostName = NetworkUtils.canonize(InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException e) { qualifiedHostName = null;
@Override public void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { final ServiceTarget serviceTarget = serviceActivatorContext.getServiceTarget(); final ServiceName endpointName = managementSubsystemEndpoint ? RemotingServices.SUBSYSTEM_ENDPOINT : ManagementRemotingServices.MANAGEMENT_ENDPOINT; final EndpointService.EndpointType endpointType = managementSubsystemEndpoint ? EndpointService.EndpointType.SUBSYSTEM : EndpointService.EndpointType.MANAGEMENT; try { // TODO see if we can figure out a way to work in the vault resolver instead of having to use ExpressionResolver.DEFAULT @SuppressWarnings("deprecation") final OptionMap options = EndpointConfigFactory.create(ExpressionResolver.DEFAULT, endpointConfig, DEFAULTS); ManagementRemotingServices.installRemotingManagementEndpoint(serviceTarget, endpointName, WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null), endpointType, options, null, null); // Install the communication services final int port = managementSocket.getPort(); final String host = NetworkUtils.canonize(managementSocket.getAddress().getHostAddress()); HostControllerConnectionService service = new HostControllerConnectionService(host, port, serverName, serverProcessName, authKey, initialOperationID, managementSubsystemEndpoint); Services.addServerExecutorDependency(serviceTarget.addService(HostControllerConnectionService.SERVICE_NAME, service), service.getExecutorInjector(), false) .addDependency(endpointName, Endpoint.class, service.getEndpointInjector()) .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.getProcessStateServiceInjectedValue()) .setInitialMode(ServiceController.Mode.ACTIVE).install(); } catch (OperationFailedException e) { throw new ServiceRegistryException(e); } }
configurationBuilder.host(address.getAddress().getHostAddress()); configurationBuilder.port(address.getPort()); } else { configurationBuilder.startTransport(false); ROOT_LOGGER.endpointStarted(serverName + qual, address != null ? NetworkUtils.formatAddress(address) : "None");
/** * Generates and returns the URI that corresponds to the remote outbound connection. * If the URI has already been generated in a previous request, then it returns that back. * Else the URI is constructed out of the outbound socket binding's destination address and destination port. * * @return * @throws IOException * @throws URISyntaxException */ private synchronized URI getConnectionURI() throws IOException, URISyntaxException { if (this.connectionURI != null) { return this.connectionURI; } final OutboundSocketBinding destinationOutboundSocket = this.destinationOutboundSocketBindingInjectedValue.getValue(); final InetAddress destinationAddress = destinationOutboundSocket.getDestinationAddress(); final int port = destinationOutboundSocket.getDestinationPort(); this.connectionURI = new URI(REMOTE_URI_SCHEME + NetworkUtils.formatPossibleIpv6Address( destinationAddress.getHostAddress()) + ":" + port); return this.connectionURI; }
qualifiedHostName = NetworkUtils.canonize(InetAddressUtil.getLocalHost().getHostName()); } catch (UnknownHostException e) { qualifiedHostName = null;
/** * Formats input address. For IPV4 returns simply host address, for IPV6 formats address according to <a * href="http://tools.ietf.org/html/rfc5952">RFC5952</a> rules. It embeds IPV6 address in '[', ']'. * * @param inet * @return */ public static String formatIPAddressForURI(InetAddress inet){ if(inet == null){ throw new IllegalArgumentException(); } if(inet instanceof Inet4Address){ return inet.getHostAddress(); } else if (inet instanceof Inet6Address){ return '[' + formatAddress(inet) + ']'; } else { return inet.getHostAddress(); } }
public static String formatPossibleIpv6Address(String address) { if(address == null) { return null; } String ipv6Address; if (address.startsWith("[") && address.endsWith("]")) { ipv6Address = address.substring(0, address.lastIndexOf(']')).substring(1); } else { ipv6Address = address; } // Definitely not an IPv6, return untouched input. if (!mayBeIPv6Address(ipv6Address)) { return ipv6Address; } return '[' + canonize(ipv6Address) + ']'; }
private static boolean checkForHp() { return checkForPresence("os.name", "hp"); }
host = NetworkUtils.canonize(clientMapping.getDestinationAddress()); port = clientMapping.getDestinationPort(); port = sa.getPort(); if (sa.getAddress().isLoopbackAddress()) { host = NetworkUtils.canonize(sa.getAddress().getHostName()); } else { host = NetworkUtils.canonize(sa.getAddress().getHostAddress()); OutboundSocketBinding binding = outboundSocketBindings.get(name).get(); port = binding.getDestinationPort(); host = NetworkUtils.canonize(binding.getUnresolvedDestinationAddress()); if (binding.getSourceAddress() != null) { tc.getParams().put(TransportConstants.LOCAL_ADDRESS_PROP_NAME, NetworkUtils.canonize(binding.getSourceAddress().getHostAddress()));
hostname = NetworkUtils.formatPossibleIpv6Address(InetAddress.getByName(hostname).getHostAddress()); } catch (UnknownHostException ex) { String message = "Cannot resolve host address: " + hostname + " , error : " + ex.getMessage();