├── Jenkinsfile ├── src └── main │ ├── resources │ ├── jndi.properties │ ├── com │ │ └── redhat │ │ │ └── jenkins │ │ │ └── plugins │ │ │ └── amqpbuildtrigger │ │ │ ├── AmqpBuildTrigger │ │ │ ├── help.html │ │ │ └── config.jelly │ │ │ └── AmqpBrokerParams │ │ │ ├── help-user.html │ │ │ ├── help-password.html │ │ │ ├── help-url.html │ │ │ ├── help-sourceAddr.html │ │ │ └── config.jelly │ └── index.jelly │ └── java │ └── com │ └── redhat │ └── jenkins │ └── plugins │ ├── amqpbuildtrigger │ ├── package-info.java │ ├── RemoteBuildCause.java │ ├── AmqpMessageListener.java │ ├── JenkinsEventListener.java │ ├── ConnectionUpdateTimer.java │ ├── AmqpBuildTrigger.java │ ├── ConnectionManager.java │ ├── AmqpConnection.java │ └── AmqpBrokerParams.java │ └── validator │ ├── RegexValidator.java │ ├── InetAddressValidator.java │ ├── UrlValidator.java │ └── DomainValidator.java ├── .gitignore ├── images ├── image_A.png ├── image_B.png ├── image_C.png └── image_D.png ├── LICENSE ├── README.md └── pom.xml /Jenkinsfile: -------------------------------------------------------------------------------- 1 | buildPlugin() 2 | 3 | -------------------------------------------------------------------------------- /src/main/resources/jndi.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings/ 4 | target/ 5 | work/ 6 | /bin/ 7 | -------------------------------------------------------------------------------- /images/image_A.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/amqp-build-trigger-plugin/master/images/image_A.png -------------------------------------------------------------------------------- /images/image_B.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/amqp-build-trigger-plugin/master/images/image_B.png -------------------------------------------------------------------------------- /images/image_C.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/amqp-build-trigger-plugin/master/images/image_C.png -------------------------------------------------------------------------------- /images/image_D.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/amqp-build-trigger-plugin/master/images/image_D.png -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/package-info.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | -------------------------------------------------------------------------------- /src/main/resources/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBuildTrigger/help.html: -------------------------------------------------------------------------------- 1 |
2 |

Add one or more AMQP message source(s) that will provide messages used to trigger a build.

3 |
4 | -------------------------------------------------------------------------------- /src/main/resources/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBrokerParams/help-user.html: -------------------------------------------------------------------------------- 1 |
2 |

If the broker requires authentication, then this field must contain the user's ID.

3 |

If no authentication is required, then leave blank.

4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBrokerParams/help-password.html: -------------------------------------------------------------------------------- 1 |
2 |

If the server requires authentication, then this field must contain the user's password.

3 |

If no authentication is required, then leave blank.

4 |
5 | -------------------------------------------------------------------------------- /src/main/resources/index.jelly: -------------------------------------------------------------------------------- 1 | 2 |
3 | This plugin allows jobs to connect to one or more AMQP sources (often brokers with a queue or topic), 4 | receive messages from them, and trigger a build when the message is received. 5 |
6 | -------------------------------------------------------------------------------- /src/main/resources/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBrokerParams/help-url.html: -------------------------------------------------------------------------------- 1 |
2 |

URL for the AMQP source (typically a queue or topic) which will host the queue or topic from which trigger messages will be received.

3 |

Format: amqp[s]://<broker-ip-address>[:<port>]

4 |

Required

5 |
-------------------------------------------------------------------------------- /src/main/resources/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBrokerParams/help-sourceAddr.html: -------------------------------------------------------------------------------- 1 |
2 |

The address of an AMQP message source from which trigger messages will be received. This is frequently a 3 | queue or topic on an AMQP broker. The source address must exist, or the server must be capable of creating it 4 | on-demand if it does not exist (which may require some server configuration).

5 |

Required

6 |
7 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/RemoteBuildCause.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | 3 | import hudson.model.Cause; 4 | 5 | public class RemoteBuildCause extends Cause { 6 | 7 | private final String messageSource; 8 | 9 | public RemoteBuildCause(String messageSource) { 10 | this.messageSource = messageSource; 11 | } 12 | 13 | @Override 14 | public String getShortDescription() { 15 | return "Triggered by remote build message from AMQP source: " + messageSource; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBuildTrigger/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 |
9 |
10 | -------------------------------------------------------------------------------- /src/main/resources/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBrokerParams/config.jelly: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 RedHat, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpMessageListener.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | 3 | import java.util.Set; 4 | import java.util.logging.Logger; 5 | 6 | import javax.jms.Message; 7 | import javax.jms.MessageListener; 8 | 9 | public class AmqpMessageListener implements MessageListener { 10 | 11 | private static final Logger LOGGER = Logger.getLogger(AmqpBuildTrigger.class.getName()); 12 | private final AmqpBrokerParams brokerParams; 13 | private final Set triggers; 14 | 15 | public AmqpMessageListener(AmqpBrokerParams brokerParams, Set triggers) { 16 | this.brokerParams = brokerParams; 17 | this.triggers = triggers; 18 | } 19 | 20 | @Override 21 | public void onMessage(Message message) { 22 | try { 23 | LOGGER.info("Message received on broker " + brokerParams.toString() + "; msg=" + message.toString()); 24 | for (AmqpBuildTrigger t : triggers) { 25 | LOGGER.info("Remote build triggered: " + t.getProjectName()); 26 | t.scheduleBuild(brokerParams.toString(), null); 27 | } 28 | } catch (Exception e) { 29 | LOGGER.warning("Exception thrown in RemoteBuildListener.onMessage(): " + e.getMessage()); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/JenkinsEventListener.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | 3 | import hudson.Extension; 4 | import hudson.model.Item; 5 | import hudson.model.listeners.ItemListener; 6 | 7 | import java.util.logging.Logger; 8 | 9 | @Extension 10 | public class JenkinsEventListener extends ItemListener { 11 | private static final Logger LOGGER = Logger.getLogger(JenkinsEventListener.class.getName()); 12 | 13 | @Override 14 | public final void onLoaded() { 15 | LOGGER.info("Starting AMQP Build Trigger"); 16 | ConnectionManager.getInstance().initialize(); 17 | // TODO: Start ConnectionUpdateTimer 18 | super.onLoaded(); 19 | } 20 | 21 | @Override 22 | public final void onUpdated(Item item) { 23 | LOGGER.info("Job updated: " + item.getFullName()); 24 | ConnectionManager.getInstance().initialize(); 25 | super.onUpdated(item); 26 | } 27 | 28 | @Override 29 | public final void onBeforeShutdown() { 30 | LOGGER.info("Shutting down AMQP Build Trigger"); 31 | ConnectionManager.getInstance().shutdown(); 32 | // TODO: Stop ConnectionUpdateTimer 33 | super.onBeforeShutdown(); 34 | } 35 | 36 | public static JenkinsEventListener get() { 37 | return ItemListener.all().get(JenkinsEventListener.class); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/ConnectionUpdateTimer.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | 3 | import hudson.Extension; 4 | import hudson.model.AperiodicWork; 5 | 6 | @Extension 7 | public class ConnectionUpdateTimer extends AperiodicWork { 8 | 9 | private static final long DEFAULT_RECCURENCE_TIME = 60000; // ms, ie 60 sec 10 | private static final long INITIAL_DELAY_TIME = 15000; // ms, ie 15 sec 11 | 12 | private volatile boolean stopRequested; 13 | private long reccurencePeriod; 14 | 15 | public ConnectionUpdateTimer() { 16 | this(DEFAULT_RECCURENCE_TIME, false); 17 | } 18 | 19 | public ConnectionUpdateTimer(long reccurencePeriod, boolean stopRequested) { 20 | this.reccurencePeriod = reccurencePeriod; 21 | this.stopRequested = stopRequested; 22 | } 23 | 24 | @Override 25 | public long getRecurrencePeriod() { 26 | return reccurencePeriod; 27 | } 28 | 29 | @Override 30 | public long getInitialDelay() { 31 | return INITIAL_DELAY_TIME; 32 | } 33 | 34 | @Override 35 | public AperiodicWork getNewInstance() { 36 | return new ConnectionUpdateTimer(reccurencePeriod, stopRequested); 37 | } 38 | 39 | @Override 40 | protected void doAperiodicRun() { 41 | if (!stopRequested) { 42 | ConnectionManager.getInstance().update(); 43 | } 44 | } 45 | 46 | public void stop() { 47 | stopRequested = true; 48 | } 49 | 50 | public void start() { 51 | stopRequested = false; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/validator/RegexValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.redhat.jenkins.plugins.validator; 18 | 19 | import java.util.regex.Matcher; 20 | import java.util.regex.Pattern; 21 | 22 | public class RegexValidator { 23 | private final Pattern[] patterns; 24 | 25 | public RegexValidator(String regex) { 26 | this(regex, true); 27 | } 28 | 29 | public RegexValidator(String regex, boolean caseSensitive) { 30 | this(new String[] {regex}, caseSensitive); 31 | } 32 | 33 | public RegexValidator(String[] regexs, boolean caseSensitive) { 34 | if (regexs == null || regexs.length == 0) { 35 | throw new IllegalArgumentException("Regular expressions are missing"); 36 | } 37 | patterns = new Pattern[regexs.length]; 38 | int flags = (caseSensitive ? 0: Pattern.CASE_INSENSITIVE); 39 | for (int i = 0; i < regexs.length; i++) { 40 | if (regexs[i] == null || regexs[i].length() == 0) { 41 | throw new IllegalArgumentException("Regular expression[" + i + "] is missing"); 42 | } 43 | patterns[i] = Pattern.compile(regexs[i], flags); 44 | } 45 | } 46 | 47 | /* 48 | * Validate a value against the set of regular expressions. 49 | */ 50 | public boolean isValid(String value) { 51 | if (value == null) return false; 52 | for (int i = 0; i < patterns.length; i++) { 53 | if (patterns[i].matcher(value).matches()) return true; 54 | } 55 | return false; 56 | } 57 | 58 | /* 59 | * Validate a value against the set of regular expressions 60 | * returning the array of matched groups. 61 | */ 62 | public String[] match(String value) { 63 | if (value == null) return null; 64 | for (int i = 0; i < patterns.length; i++) { 65 | Matcher matcher = patterns[i].matcher(value); 66 | if (matcher.matches()) { 67 | int count = matcher.groupCount(); 68 | String[] groups = new String[count]; 69 | for (int j = 0; j < count; j++) { 70 | groups[j] = matcher.group(j+1); 71 | } 72 | return groups; 73 | } 74 | } 75 | return null; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AMQP Build Trigger for Jenkins 2 | This Jenkins plugin will trigger builds when AMQP messages are received from AMQP message sources (typically a broker with a queue or topic). Each job may specify one or more AMQP sources from which to recieve messages. If any AMQP message is received from any of the configured sources, then a build is triggered. The same source may also be used to trigger multiple jobs. 3 | 4 | Note that the message content plays no role in message triggering. The only criterion for triggering a job is that a message is received from the specified AMQP source. 5 | 6 | ## Basic Configuration 7 | Within each job, scroll down to the **Build Triggers** section (or click on the **Build Triggers** tab) and then locate the **[AmqpBuildTrigger]** checkbox. Select the **[AmqpBuildTrigger]** checkbox to enable the trigger. 8 | 9 | ![AMQP Build Trigger location](images/image_A.png) 10 | 11 | Each job may specify multiple AMQP sources for trigger messages. Initially, the list will be empty. Click the **Add** button to add an AMQP trigger source. 12 | 13 | ![Adding a new AMQP server](images/image_B.png) 14 | 15 | This will create a new empty server parameters block. To complete this block: 16 | 17 | * Enter the **URL** in the format `amqp://ip-addr[:port]`, eg `amqp://localhost` or `amqp://localhost:5672` or `amqp://10.0.0.5:35672` 18 | * If necessary, enter a **User** and **Password** for logging onto the server. If supplied, the connection will use SASL `PLAIN` authentication, otherwise if left blank, `ANONYMOUS`. Make sure the server is configured for this type of access and that the user (if set) is known to it. 19 | * Enter a **Source address** from which to receive messages. If the server is a broker, then this is usually the name of a *queue* or *topic*. 20 | 21 | ![Server properties block](images/image_C.png) 22 | 23 | * A **Test Source** button if clicked will establish a temporary connection to the server and report `Ok` if it worked, otherwise an error message will be displayed. 24 | 25 | To add additional sources, click the **Add** button. To remove a source, click the red **X** button at the top of each block. 26 | 27 | Finally, click the **Save** button at the bottom of the form to save the settings. Once these settings are saved, a new connection to each server will be established and a listener will wait for messages. 28 | 29 | **NOTE:** If you have the `qpid-cpp-client-devel` package installed, it is possible to test a configuration by quickly sending a trigger message using `qpid-send` through a broker as follows (and to which the trigger must be configured to listen): 30 | ``` 31 | qpid-send [-b ] -a -m1 32 | ``` 33 | where `` is the broker URL (defaults to `localhost` if not provided), and `` is replaced by the queue name configured in the **Source Address** field for your project. To get help, use `qpid-send -h` or `qpid-send --help`. 34 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | org.jenkins-ci.plugins 6 | plugin 7 | 3.26 8 | 9 | 10 | io.jenkins.plugins 11 | amqp-build-trigger 12 | 1.1-SNAPSHOT 13 | hpi 14 | 15 | 2.7.3 16 | 8 17 | 18 | AMQP Build Trigger Plugin 19 | Trigger a build when a message received from an AMQP message source (usually a queue or topic). 20 | 21 | 22 | MIT License 23 | https://opensource.org/licenses/MIT 24 | 25 | 26 | https://wiki.jenkins.io/display/JENKINS/AMQP+Build+Trigger+Plugin 27 | 28 | scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git 29 | scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git 30 | https://github.com/jenkinsci/${project.artifactId}-plugin 31 | HEAD 32 | 33 | 34 | 35 | kpvdr 36 | Kim van der Riet 37 | kpvdr@apache.org 38 | 39 | 40 | 41 | 42 | repo.jenkins-ci.org 43 | https://repo.jenkins-ci.org/public/ 44 | 45 | 46 | 47 | 48 | repo.jenkins-ci.org 49 | https://repo.jenkins-ci.org/public/ 50 | 51 | 52 | 53 | 54 | org.apache.commons 55 | commons-lang3 56 | 3.8 57 | 58 | 63 | 64 | org.apache.geronimo.specs 65 | geronimo-jms_2.0_spec 66 | 1.0-alpha-2 67 | 68 | 69 | org.apache.qpid 70 | qpid-jms-client 71 | 0.42.0 72 | 73 | 74 | org.jenkins-ci.plugins.workflow 75 | workflow-job 76 | 2.12.2 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBuildTrigger.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | 3 | import hudson.Extension; 4 | import hudson.model.CauseAction; 5 | import hudson.model.Item; 6 | import hudson.model.Job; 7 | import hudson.model.ParameterDefinition; 8 | import hudson.model.ParameterValue; 9 | import hudson.model.ParametersAction; 10 | import hudson.model.ParametersDefinitionProperty; 11 | import hudson.model.StringParameterValue; 12 | import hudson.triggers.Trigger; 13 | import hudson.triggers.TriggerDescriptor; 14 | 15 | import java.util.concurrent.CopyOnWriteArrayList; 16 | import java.util.List; 17 | 18 | import jenkins.model.Jenkins; 19 | import jenkins.model.ParameterizedJobMixIn; 20 | 21 | import net.sf.json.JSONArray; 22 | import net.sf.json.JSONObject; 23 | 24 | import org.kohsuke.stapler.DataBoundConstructor; 25 | import org.kohsuke.stapler.DataBoundSetter; 26 | 27 | public class AmqpBuildTrigger & ParameterizedJobMixIn.ParameterizedJob> extends Trigger { 28 | private static final String KEY_PARAM_NAME = "name"; 29 | private static final String KEY_PARAM_VALUE = "value"; 30 | private static final String PLUGIN_NAME = "[AmqpBuildTrigger] - Trigger builds using AMQP 1.0 messages"; 31 | private List amqpBrokerParamsList = new CopyOnWriteArrayList(); 32 | 33 | @DataBoundConstructor 34 | public AmqpBuildTrigger(List amqpBrokerParamsList) { 35 | super(); 36 | this.amqpBrokerParamsList = amqpBrokerParamsList; 37 | } 38 | 39 | public List getAmqpBrokerParamsList() { 40 | return amqpBrokerParamsList; 41 | } 42 | 43 | @DataBoundSetter 44 | public void setAmqpBrokerParamsList(List amqpBrokerParamsList) { 45 | this.amqpBrokerParamsList = amqpBrokerParamsList; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return getProjectName(); 51 | } 52 | 53 | public String getProjectName() { 54 | if(job != null){ 55 | return job.getFullName(); 56 | } 57 | return ""; 58 | } 59 | 60 | public void scheduleBuild(String messageSource, JSONArray jsonArray) { 61 | if (job != null) { 62 | if (jsonArray != null) { 63 | List parameters = getUpdatedParameters(jsonArray, getDefinitionParameters(job)); 64 | ParameterizedJobMixIn.scheduleBuild2(job, 0, new CauseAction(new RemoteBuildCause(messageSource)), new ParametersAction(parameters)); 65 | } else { 66 | ParameterizedJobMixIn.scheduleBuild2(job, 0, new CauseAction(new RemoteBuildCause(messageSource))); 67 | } 68 | } 69 | } 70 | 71 | private List getUpdatedParameters(JSONArray jsonParameters, List definedParameters) { 72 | List newParams = new CopyOnWriteArrayList(); 73 | for (ParameterValue defParam : definedParameters) { 74 | for (int i = 0; i < jsonParameters.size(); i++) { 75 | JSONObject jsonParam = jsonParameters.getJSONObject(i); 76 | if (defParam.getName().toUpperCase().equals(jsonParam.getString(KEY_PARAM_NAME).toUpperCase())) { 77 | newParams.add(new StringParameterValue(defParam.getName(), jsonParam.getString(KEY_PARAM_VALUE))); 78 | } 79 | } 80 | } 81 | return newParams; 82 | } 83 | 84 | private List getDefinitionParameters(Job project) { 85 | List parameters = new CopyOnWriteArrayList(); 86 | ParametersDefinitionProperty properties = project.getProperty(ParametersDefinitionProperty.class); 87 | if (properties != null) { 88 | for (ParameterDefinition paramDef : properties.getParameterDefinitions()) { 89 | ParameterValue param = paramDef.getDefaultParameterValue(); 90 | if (param != null) { 91 | parameters.add(param); 92 | } 93 | } 94 | } 95 | return parameters; 96 | } 97 | 98 | @Override 99 | public AmqpBuildTriggerDescriptor getDescriptor() { 100 | return (AmqpBuildTriggerDescriptor) Jenkins.getInstance().getDescriptor(getClass()); 101 | } 102 | 103 | @Extension 104 | public static class AmqpBuildTriggerDescriptor extends TriggerDescriptor { 105 | 106 | @Override 107 | public boolean isApplicable(Item item) { 108 | return true; 109 | } 110 | 111 | @Override 112 | public String getDisplayName() { 113 | return PLUGIN_NAME; 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/validator/InetAddressValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.redhat.jenkins.plugins.validator; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | public class InetAddressValidator { 24 | private static final int IPV4_MAX_OCTET_VALUE = 255; 25 | private static final int MAX_UNSIGNED_SHORT = 0xffff; 26 | private static final int BASE_16 = 16; 27 | 28 | private static final String IPV4_REGEX = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"; 29 | 30 | // Max number of hex groups (separated by :) in an IPV6 address 31 | private static final int IPV6_MAX_HEX_GROUPS = 8; 32 | 33 | // Max hex digits in each IPv6 group 34 | private static final int IPV6_MAX_HEX_DIGITS_PER_GROUP = 4; 35 | 36 | // Singleton instance of this class 37 | private static final InetAddressValidator VALIDATOR = new InetAddressValidator(); 38 | 39 | // IPv4 RegexValidator 40 | private final RegexValidator ipv4Validator = new RegexValidator(IPV4_REGEX); 41 | 42 | public static InetAddressValidator getInstance() { 43 | return VALIDATOR; 44 | } 45 | 46 | /* 47 | * Validates an IPv4 address. Returns true if valid. 48 | */ 49 | public boolean isValidInet4Address(String inet4Address) { 50 | // verify that address conforms to generic IPv4 format 51 | String[] groups = ipv4Validator.match(inet4Address); 52 | if (groups == null) return false; 53 | 54 | // Verify that address subgroups are legal 55 | for (String ipSegment : groups) { 56 | if (ipSegment == null || ipSegment.length() == 0) return false; 57 | int iIpSegment = 0; 58 | try { 59 | iIpSegment = Integer.parseInt(ipSegment); 60 | } catch(NumberFormatException e) { 61 | return false; 62 | } 63 | if (iIpSegment > IPV4_MAX_OCTET_VALUE) return false; 64 | if (ipSegment.length() > 1 && ipSegment.startsWith("0")) return false; 65 | } 66 | return true; 67 | } 68 | 69 | /* 70 | * Validates an IPv6 address. Returns true if valid. 71 | */ 72 | public boolean isValidInet6Address(String inet6Address) { 73 | boolean containsCompressedZeroes = inet6Address.contains("::"); 74 | if (containsCompressedZeroes && (inet6Address.indexOf("::") != inet6Address.lastIndexOf("::"))) return false; 75 | if ((inet6Address.startsWith(":") && !inet6Address.startsWith("::")) || 76 | (inet6Address.endsWith(":") && !inet6Address.endsWith("::"))) return false; 77 | String[] octets = inet6Address.split(":"); 78 | if (containsCompressedZeroes) { 79 | List octetList = new ArrayList(Arrays.asList(octets)); 80 | if (inet6Address.endsWith("::")) { 81 | // String.split() drops ending empty segments 82 | octetList.add(""); 83 | } else if (inet6Address.startsWith("::") && !octetList.isEmpty()) { 84 | octetList.remove(0); 85 | } 86 | octets = octetList.toArray(new String[octetList.size()]); 87 | } 88 | if (octets.length > IPV6_MAX_HEX_GROUPS) return false; 89 | int validOctets = 0; 90 | int emptyOctets = 0; // consecutive empty chunks 91 | for (int index = 0; index < octets.length; index++) { 92 | String octet = octets[index]; 93 | if (octet.length() == 0) { 94 | emptyOctets++; 95 | if (emptyOctets > 1) return false; 96 | } else { 97 | emptyOctets = 0; 98 | // Is last chunk an IPv4 address? 99 | if (index == octets.length - 1 && octet.contains(".")) { 100 | if (!isValidInet4Address(octet)) return false; 101 | validOctets += 2; 102 | continue; 103 | } 104 | if (octet.length() > IPV6_MAX_HEX_DIGITS_PER_GROUP) return false; 105 | int octetInt = 0; 106 | try { 107 | octetInt = Integer.parseInt(octet, BASE_16); 108 | } catch (NumberFormatException e) { 109 | return false; 110 | } 111 | if (octetInt < 0 || octetInt > MAX_UNSIGNED_SHORT) return false; 112 | } 113 | validOctets++; 114 | } 115 | if (validOctets > IPV6_MAX_HEX_GROUPS || (validOctets < IPV6_MAX_HEX_GROUPS && !containsCompressedZeroes)) return false; 116 | return true; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/ConnectionManager.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | 3 | import hudson.model.Project; 4 | import hudson.triggers.Trigger; 5 | import hudson.triggers.TriggerDescriptor; 6 | 7 | import java.net.URI; 8 | import java.util.concurrent.ConcurrentHashMap; 9 | import java.util.List; 10 | import java.util.logging.Logger; 11 | import java.util.Map; 12 | 13 | import javax.jms.MessageConsumer; 14 | import javax.jms.MessageProducer; 15 | import javax.jms.Session; 16 | 17 | import jenkins.model.Jenkins; 18 | 19 | import org.apache.qpid.jms.JmsConnectionListener; 20 | import org.apache.qpid.jms.message.JmsInboundMessageDispatch; 21 | 22 | import org.jenkinsci.plugins.workflow.job.WorkflowJob; 23 | 24 | public class ConnectionManager implements JmsConnectionListener { 25 | 26 | private static final Logger LOGGER = Logger.getLogger(ConnectionManager.class.getName()); 27 | private Map connectionMap; 28 | 29 | private static class InstanceHolder { 30 | private static final ConnectionManager INSTANCE = new ConnectionManager(); 31 | } 32 | 33 | public static ConnectionManager getInstance() { 34 | return InstanceHolder.INSTANCE; 35 | } 36 | 37 | public ConnectionManager() { 38 | connectionMap = new ConcurrentHashMap(); 39 | } 40 | 41 | protected void addBuildTrigger(AmqpBuildTrigger trigger) { 42 | List brokerParamsList = trigger.getAmqpBrokerParamsList(); 43 | if (brokerParamsList != null && !brokerParamsList.isEmpty()) { 44 | for (AmqpBrokerParams url: brokerParamsList) { 45 | if (connectionMap.containsKey(url.toString())) { 46 | // Add trigger to existing connection 47 | if (!connectionMap.get(url.toString()).addBuildTrigger(trigger)) { 48 | LOGGER.warning("ConnectionManager.addBuildTrigger(): failed to add trigger " + trigger.getProjectName() + " to existing connection"); 49 | } 50 | } else { 51 | // Create new connection 52 | AmqpConnection c = new AmqpConnection(url); 53 | if (!c.addBuildTrigger(trigger)) { 54 | LOGGER.warning("ConnectionManager.addBuildTrigger(): failed to add trigger " + trigger.getProjectName() + " to new connection"); 55 | } 56 | connectionMap.put(url.toString(), c); 57 | } 58 | } 59 | } 60 | } 61 | 62 | public void initialize() { 63 | shutdown(); 64 | connectionMap.clear(); 65 | 66 | Jenkins jenkins = Jenkins.getInstance(); 67 | if (jenkins != null) { 68 | // Find triggers for freestyle jobs 69 | for (Project p : jenkins.getAllItems(Project.class)) { 70 | AmqpBuildTrigger t = p.getTrigger(AmqpBuildTrigger.class); 71 | if (t != null) { 72 | addBuildTrigger(t); 73 | } 74 | } 75 | // Find triggers for Pipelines/workflow jobs 76 | for (WorkflowJob j : jenkins.getAllItems(WorkflowJob.class)) { 77 | Map> m = j.getTriggers(); 78 | for (Map.Entry> entry: m.entrySet()) { 79 | if (entry.getKey() instanceof AmqpBuildTrigger.AmqpBuildTriggerDescriptor) { 80 | AmqpBuildTrigger t = (AmqpBuildTrigger) entry.getValue(); 81 | if (t != null) { 82 | addBuildTrigger(t); 83 | } 84 | } 85 | } 86 | } 87 | } 88 | update(); 89 | } 90 | 91 | public void update() { 92 | for (Map.Entry c: connectionMap.entrySet()) { 93 | c.getValue().update(); 94 | } 95 | } 96 | 97 | public void shutdown() { 98 | for (Map.Entry c: connectionMap.entrySet()) { 99 | c.getValue().shutdown(); 100 | } 101 | } 102 | 103 | @Override 104 | public void onConnectionEstablished(URI remoteURI) { 105 | LOGGER.info(remoteURI + ": Connection established"); 106 | } 107 | 108 | @Override 109 | public void onConnectionFailure(Throwable error) { 110 | LOGGER.warning("Connection to broker failed: " + error.getMessage()); 111 | } 112 | 113 | @Override 114 | public void onConnectionInterrupted(URI remoteURI) { 115 | LOGGER.info(remoteURI + ": Connection interrupted"); 116 | } 117 | 118 | @Override 119 | public void onConnectionRestored(URI remoteURI) { 120 | LOGGER.info(remoteURI + ": Connection restored"); 121 | } 122 | 123 | @Override 124 | public void onInboundMessage(JmsInboundMessageDispatch envelope) { 125 | LOGGER.info("AMQP message received: " + envelope.getMessage()); 126 | } 127 | 128 | @Override 129 | public void onSessionClosed(Session session, Throwable cause) { 130 | LOGGER.info("Session " + session.toString() + " closed: " + cause.getMessage()); 131 | } 132 | 133 | @Override 134 | public void onConsumerClosed(MessageConsumer consumer, Throwable cause) { 135 | LOGGER.info("Consumer " + consumer.toString() + " closed: " + cause.getMessage()); 136 | } 137 | 138 | @Override 139 | public void onProducerClosed(MessageProducer producer, Throwable cause) {} 140 | 141 | } 142 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpConnection.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | 3 | import java.util.concurrent.CopyOnWriteArraySet; 4 | import java.util.logging.Logger; 5 | import java.util.Set; 6 | 7 | import javax.jms.ExceptionListener; 8 | import javax.jms.JMSException; 9 | import javax.jms.MessageConsumer; 10 | import javax.jms.Queue; 11 | import javax.jms.Session; 12 | 13 | import org.apache.qpid.jms.JmsConnection; 14 | import org.apache.qpid.jms.JmsConnectionFactory; 15 | 16 | //Temporary, until enforcer issues with org.apache.commons.validator can be sorted out 17 | import com.redhat.jenkins.plugins.validator.UrlValidator; 18 | 19 | public class AmqpConnection { 20 | private static final Logger LOGGER = Logger.getLogger(AmqpBuildTrigger.class.getName()); 21 | private final Set triggers = new CopyOnWriteArraySet(); 22 | private AmqpBrokerParams brokerParams; 23 | private JmsConnection connection = null; 24 | private Session session = null; 25 | private MessageConsumer messageConsumer = null; 26 | 27 | public AmqpConnection(AmqpBrokerParams brokerParams) { 28 | this.brokerParams = brokerParams; 29 | } 30 | 31 | public boolean addBuildTrigger(AmqpBuildTrigger trigger) { 32 | if (trigger != null) { 33 | return triggers.add(trigger); 34 | } 35 | return false; 36 | } 37 | 38 | public void update() { 39 | if (!brokerParams.isValid()) { 40 | shutdown(); 41 | return; 42 | } 43 | if (connection != null && 44 | !brokerParams.getUrl().equals(connection.getConnectedURI().toString().split("\\?")[0]) && 45 | !brokerParams.getUser().equals(connection.getUsername()) && 46 | !brokerParams.getPassword().getPlainText().equals(connection.getPassword())) { 47 | shutdown(); 48 | } 49 | if (connection != null && connection.isConnected() == false) { 50 | shutdown(); 51 | } 52 | if (connection == null) { 53 | open(getMessageListener()); 54 | } 55 | } 56 | 57 | public boolean open(AmqpMessageListener listener) { 58 | String url = brokerParams.getUrl(); 59 | UrlValidator urlValidator = new UrlValidator(); 60 | if (url != null && urlValidator.isValid(url)) { 61 | try { 62 | JmsConnectionFactory factory = new JmsConnectionFactory(url); 63 | if (brokerParams.getUser().isEmpty() || brokerParams.getPassword().getPlainText().isEmpty()) { 64 | connection = (JmsConnection)factory.createConnection(); 65 | } else { 66 | connection = (JmsConnection)factory.createConnection(brokerParams.getUser(), brokerParams.getPassword().getPlainText()); 67 | } 68 | connection.setExceptionListener(new MyExceptionListener()); 69 | connection.addConnectionListener(ConnectionManager.getInstance()); 70 | session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 71 | 72 | Queue queue = session.createQueue(brokerParams.getSourceAddr()); 73 | messageConsumer = session.createConsumer(queue); 74 | messageConsumer.setMessageListener(new AmqpMessageListener(brokerParams, triggers)); 75 | 76 | connection.start(); 77 | 78 | LOGGER.info("Created listener for broker \"" + brokerParams.toString() + "\" containing " + triggers.size() + 79 | (triggers.size() == 1 ? " trigger" : " triggers") + " " + triggers.toString()); 80 | } catch (JMSException e) { 81 | LOGGER.severe(e.getMessage()); 82 | return false; 83 | } 84 | } else { 85 | LOGGER.warning("Invalid Server URL \"" + url + "\", unable to open connection"); 86 | return false; 87 | } 88 | return true; 89 | } 90 | 91 | public void shutdown() { 92 | if (messageConsumer != null) { 93 | try { 94 | messageConsumer.close(); 95 | } catch (JMSException e) { 96 | LOGGER.warning("Cannot close message consumer for broker " + brokerParams.toString() + ". " + e.getMessage()); 97 | } finally { 98 | messageConsumer = null; 99 | } 100 | } 101 | if (session != null) { 102 | try { 103 | session.close(); 104 | } catch (JMSException e) { 105 | LOGGER.warning("Cannot close session. " + e.getMessage()); 106 | } finally { 107 | session = null; 108 | } 109 | } 110 | if (connection != null) { 111 | try { 112 | connection.close(); 113 | } catch (JMSException e) { 114 | LOGGER.warning("Cannot close connection." + e.getMessage()); 115 | } finally { 116 | connection = null; 117 | } 118 | } 119 | 120 | } 121 | 122 | protected AmqpMessageListener getMessageListener() { 123 | AmqpMessageListener l = null; 124 | if (messageConsumer != null) { 125 | try { 126 | l = (AmqpMessageListener)messageConsumer.getMessageListener(); 127 | } catch (JMSException e) { 128 | LOGGER.warning(e.getMessage()); 129 | } 130 | } 131 | return l; 132 | } 133 | 134 | private static class MyExceptionListener implements ExceptionListener { 135 | @Override 136 | public void onException(JMSException exception) { 137 | LOGGER.warning(exception.getMessage()); 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/amqpbuildtrigger/AmqpBrokerParams.java: -------------------------------------------------------------------------------- 1 | package com.redhat.jenkins.plugins.amqpbuildtrigger; 2 | 3 | import hudson.Extension; 4 | import hudson.ExtensionList; 5 | import hudson.model.Describable; 6 | import hudson.model.Descriptor; 7 | import hudson.util.FormValidation; 8 | import hudson.util.Secret; 9 | 10 | import javax.jms.ExceptionListener; 11 | import javax.jms.JMSException; 12 | import javax.jms.MessageConsumer; 13 | import javax.jms.Queue; 14 | import javax.jms.Session; 15 | import javax.servlet.ServletException; 16 | 17 | import jenkins.model.Jenkins; 18 | 19 | import org.apache.commons.lang3.StringUtils; 20 | import org.apache.qpid.jms.JmsConnection; 21 | import org.apache.qpid.jms.JmsConnectionFactory; 22 | 23 | import org.kohsuke.stapler.DataBoundConstructor; 24 | import org.kohsuke.stapler.DataBoundSetter; 25 | import org.kohsuke.stapler.QueryParameter; 26 | import org.kohsuke.stapler.verb.POST; 27 | 28 | // Temporary, until enforcer issues with org.apache.commons.validator can be sorted out 29 | import com.redhat.jenkins.plugins.validator.UrlValidator; 30 | 31 | public class AmqpBrokerParams implements Describable { 32 | private static final String DISPLAY_NAME = "AMQP server parameters"; 33 | 34 | private String url; 35 | private String user; 36 | private Secret password; 37 | private String sourceAddr; 38 | 39 | @DataBoundConstructor 40 | public AmqpBrokerParams(String url, String username, Secret password, String sourceAddr) { 41 | this.url = url; 42 | this.user = username; 43 | this.password = password; 44 | this.sourceAddr = sourceAddr; 45 | } 46 | 47 | public String getUrl() { 48 | return StringUtils.strip(StringUtils.stripToNull(url), "/"); 49 | } 50 | 51 | public String getUser() { 52 | return user; 53 | } 54 | 55 | public Secret getPassword() { 56 | return password; 57 | } 58 | 59 | public String getSourceAddr() { 60 | return sourceAddr; 61 | } 62 | 63 | @DataBoundSetter 64 | public void setUrl(String url) { 65 | this.url = url; 66 | } 67 | 68 | @DataBoundSetter 69 | public void setUser(String user) { 70 | this.user = user; 71 | } 72 | 73 | @DataBoundSetter 74 | public void setPassword(Secret password) { 75 | this.password = password; 76 | } 77 | 78 | public void setUserPassword(String password) { 79 | this.password = Secret.fromString(password); 80 | } 81 | 82 | @DataBoundSetter 83 | public void setSourceAddr(String sourceAddr) { 84 | this.sourceAddr = sourceAddr; 85 | } 86 | 87 | public String toString() { 88 | return url + "/" + sourceAddr; 89 | } 90 | 91 | public boolean isValid() { 92 | if (url != null && !url.isEmpty()) { 93 | UrlValidator urlValidator = new UrlValidator(); 94 | if (!urlValidator.isValid(getUrl())) 95 | return false; 96 | } 97 | return sourceAddr != null && !sourceAddr.isEmpty(); 98 | } 99 | 100 | @Override 101 | public Descriptor getDescriptor() { 102 | return Jenkins.getInstance().getDescriptorByType(AmqpBrokerUrlDescriptor.class); 103 | } 104 | 105 | @Extension 106 | public static class AmqpBrokerUrlDescriptor extends Descriptor { 107 | 108 | @Override 109 | public String getDisplayName() { 110 | return DISPLAY_NAME; 111 | } 112 | 113 | public static ExtensionList all() { 114 | return Jenkins.getInstance().getExtensionList(AmqpBrokerUrlDescriptor.class); 115 | } 116 | 117 | @POST 118 | public FormValidation doTestConnection(@QueryParameter("url") String url, 119 | @QueryParameter("user") String user, 120 | @QueryParameter("passowrd") String password, 121 | @QueryParameter("sourceAddr") String sourceAddr) throws ServletException { 122 | Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); 123 | String uri = StringUtils.strip(StringUtils.stripToNull(url), "/"); 124 | UrlValidator urlValidator = new UrlValidator(); 125 | if (uri != null && urlValidator.isValid(uri)) { 126 | try { 127 | JmsConnectionFactory factory = new JmsConnectionFactory(uri); 128 | JmsConnection connection; 129 | Secret spw = Secret.fromString(password); 130 | if (user.isEmpty() || spw.getPlainText().isEmpty()) { 131 | connection = (JmsConnection)factory.createConnection(); 132 | } else { 133 | connection = (JmsConnection)factory.createConnection(user, spw.getPlainText()); 134 | } 135 | connection.setExceptionListener(new MyExceptionListener()); 136 | connection.start(); 137 | 138 | Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 139 | Queue queue = session.createQueue(sourceAddr); 140 | MessageConsumer messageConsumer = session.createConsumer(queue); 141 | 142 | messageConsumer.close(); 143 | session.close(); 144 | connection.close(); 145 | return FormValidation.ok("OK"); 146 | } catch (javax.jms.JMSException e) { 147 | return FormValidation.error(e.toString()); 148 | } 149 | } 150 | return FormValidation.error("Invalid server URL"); 151 | } 152 | } 153 | 154 | private static class MyExceptionListener implements ExceptionListener { 155 | @Override 156 | public void onException(JMSException exception) { 157 | System.out.println("Connection ExceptionListener fired, exiting."); 158 | exception.printStackTrace(System.out); 159 | } 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/validator/UrlValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.redhat.jenkins.plugins.validator; 18 | 19 | import java.net.URI; 20 | import java.net.URISyntaxException; 21 | import java.util.HashSet; 22 | import java.util.Locale; 23 | import java.util.Set; 24 | import java.util.regex.Matcher; 25 | import java.util.regex.Pattern; 26 | 27 | public class UrlValidator { 28 | private static final int MAX_UNSIGNED_16_BIT_INT = 0xFFFF; // port max 29 | private static final String[] DEFAULT_SCHEMES = {"amqp", "amqps"}; // Must be lower-case 30 | private static final String URL_REGEX = 31 | "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"; 32 | // 12 3 4 5 6 7 8 9 33 | private static final Pattern URL_PATTERN = Pattern.compile(URL_REGEX); 34 | private static final int PARSE_URL_SCHEME = 2; 35 | private static final int PARSE_URL_AUTHORITY = 4; 36 | private static final int PARSE_URL_PATH = 5; 37 | private static final int PARSE_URL_QUERY = 7; 38 | private static final int PARSE_URL_FRAGMENT = 9; 39 | 40 | private static final String SCHEME_REGEX = "^\\p{Alpha}[\\p{Alnum}\\+\\-\\.]*"; 41 | private static final Pattern SCHEME_PATTERN = Pattern.compile(SCHEME_REGEX); 42 | 43 | // Drop numeric, and "+-." for now 44 | // TODO does not allow for optional userinfo. 45 | // Validation of character set is done by isValidAuthority 46 | private static final String AUTHORITY_CHARS_REGEX = "\\p{Alnum}\\-\\."; // allows for IPV4 but not IPV6 47 | private static final String IPV6_REGEX = "[0-9a-fA-F:]+"; // do this as separate match because : could cause ambiguity with port prefix 48 | 49 | // userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) 50 | // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" 51 | // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" 52 | // We assume that password has the same valid chars as user info 53 | private static final String USERINFO_CHARS_REGEX = "[a-zA-Z0-9%-._~!$&'()*+,;=]"; 54 | // since neither ':' nor '@' are allowed chars, we don't need to use non-greedy matching 55 | private static final String USERINFO_FIELD_REGEX = 56 | USERINFO_CHARS_REGEX + "+" + // At least one character for the name 57 | "(?::" + USERINFO_CHARS_REGEX + "*)?@"; // colon and password may be absent 58 | 59 | private static final String AUTHORITY_REGEX = 60 | "(?:\\[("+IPV6_REGEX+")\\]|(?:(?:"+USERINFO_FIELD_REGEX+")?([" + AUTHORITY_CHARS_REGEX + "]*)))(?::(\\d*))?(.*)?"; 61 | // 1 e.g. user:pass@ 2 3 4 62 | private static final Pattern AUTHORITY_PATTERN = Pattern.compile(AUTHORITY_REGEX); 63 | private static final int PARSE_AUTHORITY_IPV6 = 1; 64 | private static final int PARSE_AUTHORITY_HOST_IP = 2; // excludes userinfo, if present 65 | private static final int PARSE_AUTHORITY_PORT = 3; // excludes leading colon 66 | private static final int PARSE_AUTHORITY_EXTRA = 4; // Should always be empty. The code currently allows spaces. 67 | 68 | private static final String PATH_REGEX = "^(/[-\\w:@&?=+,.!/~*'%$_;\\(\\)]*)?$"; 69 | private static final Pattern PATH_PATTERN = Pattern.compile(PATH_REGEX); 70 | 71 | // The set of schemes that are allowed to be in a URL. 72 | private final Set allowedSchemes; 73 | 74 | public UrlValidator() { 75 | allowedSchemes = new HashSet(DEFAULT_SCHEMES.length); 76 | for(int i=0; i < DEFAULT_SCHEMES.length; i++) { 77 | allowedSchemes.add(DEFAULT_SCHEMES[i].toLowerCase(Locale.ENGLISH)); 78 | } 79 | } 80 | 81 | /* 82 | * Checks if a field has a valid url address. 83 | */ 84 | public boolean isValid(String value) { 85 | // Check for null 86 | if (value == null) return false; 87 | 88 | // Check the whole url address structure 89 | Matcher urlMatcher = URL_PATTERN.matcher(value); 90 | if (!urlMatcher.matches()) return false; 91 | 92 | if (!isValidScheme(urlMatcher.group(PARSE_URL_SCHEME))) return false; 93 | 94 | if (!isValidAuthority(urlMatcher.group(PARSE_URL_AUTHORITY))) return false; 95 | 96 | if (!isValidPath(urlMatcher.group(PARSE_URL_PATH))) return false; 97 | 98 | if (!isValidQuery(urlMatcher.group(PARSE_URL_QUERY))) return false; 99 | 100 | if (!isValidFragment(urlMatcher.group(PARSE_URL_FRAGMENT))) return false; 101 | 102 | return true; 103 | } 104 | 105 | /* 106 | * Validate scheme. If schemes[] was initialized to a non null, 107 | * then only those schemes are allowed. 108 | */ 109 | protected boolean isValidScheme(String scheme) { 110 | if (scheme == null) return false; 111 | if (!SCHEME_PATTERN.matcher(scheme).matches()) return false; 112 | if (!allowedSchemes.contains(scheme.toLowerCase(Locale.ENGLISH))) return false; 113 | return true; 114 | } 115 | 116 | /* 117 | * Returns true if the authority is properly formatted. An authority is the combination 118 | * of hostname and port. A null authority value is considered invalid. 119 | * Note: this implementation validates the domain. 120 | */ 121 | protected boolean isValidAuthority(String authority) { 122 | if (authority == null) return false; 123 | 124 | // convert to ASCII if possible 125 | final String authorityASCII = DomainValidator.unicodeToASCII(authority); 126 | Matcher authorityMatcher = AUTHORITY_PATTERN.matcher(authorityASCII); 127 | if (!authorityMatcher.matches()) return false; 128 | 129 | // We have to process IPV6 separately because that is parsed in a different group 130 | String ipv6 = authorityMatcher.group(PARSE_AUTHORITY_IPV6); 131 | if (ipv6 != null) { 132 | InetAddressValidator inetAddressValidator = InetAddressValidator.getInstance(); 133 | if (!inetAddressValidator.isValidInet6Address(ipv6)) return false; 134 | } else { 135 | String hostLocation = authorityMatcher.group(PARSE_AUTHORITY_HOST_IP); 136 | // check if authority is hostname or IP address: 137 | // try a hostname first since that's much more likely 138 | DomainValidator domainValidator = DomainValidator.getInstance(); 139 | if (!domainValidator.isValid(hostLocation)) { 140 | InetAddressValidator inetAddressValidator = InetAddressValidator.getInstance(); 141 | if (!inetAddressValidator.isValidInet4Address(hostLocation)) return false; 142 | } 143 | String port = authorityMatcher.group(PARSE_AUTHORITY_PORT); 144 | if (port != null && port.length() > 0) { 145 | try { 146 | int iPort = Integer.parseInt(port); 147 | if (iPort < 0 || iPort > MAX_UNSIGNED_16_BIT_INT) return false; 148 | } catch (NumberFormatException nfe) { 149 | return false; 150 | } 151 | } 152 | } 153 | String extra = authorityMatcher.group(PARSE_AUTHORITY_EXTRA); 154 | if (extra != null && extra.trim().length() > 0) return false; 155 | 156 | return true; 157 | } 158 | 159 | /* 160 | * Returns true if the path is valid. A null value is considered invalid. 161 | */ 162 | protected boolean isValidPath(String path) { 163 | if (path == null) return false; 164 | if (!PATH_PATTERN.matcher(path).matches()) return false; 165 | try { 166 | URI uri = new URI(null,null,path,null); 167 | String norm = uri.normalize().getPath(); 168 | if (norm.startsWith("/../") || // Trying to go via the parent dir 169 | norm.equals("/..")) { // Trying to go to the parent dir 170 | return false; 171 | } 172 | } catch (URISyntaxException e) { 173 | return false; 174 | } 175 | 176 | // Disallow multiple slashes in path 177 | int slash2Count = countToken("//", path); 178 | if (slash2Count > 0) return false; 179 | 180 | return true; 181 | } 182 | 183 | /* 184 | * Do not allow queries 185 | */ 186 | protected boolean isValidQuery(String query) { 187 | if (query != null) return false; 188 | return true; 189 | } 190 | 191 | /* 192 | * Do not allow fragments 193 | */ 194 | protected boolean isValidFragment(String fragment) { 195 | if (fragment != null) return false; 196 | return true; 197 | } 198 | 199 | protected int countToken(String token, String target) { 200 | int tokenIndex = 0; 201 | int count = 0; 202 | while (tokenIndex != -1) { 203 | tokenIndex = target.indexOf(token, tokenIndex); 204 | if (tokenIndex > -1) { 205 | tokenIndex++; 206 | count++; 207 | } 208 | } 209 | return count; 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /src/main/java/com/redhat/jenkins/plugins/validator/DomainValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.redhat.jenkins.plugins.validator; 18 | 19 | import java.util.Arrays; 20 | import java.net.IDN; 21 | import java.util.Locale; 22 | 23 | public class DomainValidator { 24 | private static final int MAX_DOMAIN_LENGTH = 253; 25 | 26 | private static final String[] EMPTY_STRING_ARRAY = new String[0]; 27 | 28 | private static final DomainValidator DOMAIN_VALIDATOR_WITH_LOCAL = new DomainValidator(true); 29 | 30 | // RFC2396: domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum 31 | // Max 63 characters 32 | private static final String DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]{0,61}\\p{Alnum})?"; 33 | 34 | // RFC2396 toplabel = alpha | alpha *( alphanum | "-" ) alphanum 35 | // Max 63 characters 36 | private static final String TOP_LABEL_REGEX = "\\p{Alpha}(?>[\\p{Alnum}-]{0,61}\\p{Alnum})?"; 37 | 38 | // RFC2396 hostname = *( domainlabel "." ) toplabel [ "." ] 39 | // Note that the regex currently requires both a domain label and a top level label, whereas 40 | // the RFC does not. This is because the regex is used to detect if a TLD is present. 41 | // If the match fails, input is checked against DOMAIN_LABEL_REGEX (hostnameRegex) 42 | // RFC1123 sec 2.1 allows hostnames to start with a digit 43 | private static final String DOMAIN_NAME_REGEX = 44 | "^(?:" + DOMAIN_LABEL_REGEX + "\\.)+" + "(" + TOP_LABEL_REGEX + ")\\.?$"; 45 | // RegexValidator for matching domains. 46 | private final RegexValidator domainRegex = new RegexValidator(DOMAIN_NAME_REGEX); 47 | 48 | private final RegexValidator hostnameRegex = new RegexValidator(DOMAIN_LABEL_REGEX); 49 | 50 | private final boolean allowLocal; 51 | 52 | public static synchronized DomainValidator getInstance() { 53 | return DOMAIN_VALIDATOR_WITH_LOCAL; 54 | } 55 | 56 | // Private constructor 57 | private DomainValidator(boolean allowLocal) { 58 | this.allowLocal = allowLocal; 59 | } 60 | 61 | /* 62 | * Returns true if the specified String parses 63 | * as a valid domain name with a recognized top-level domain. 64 | * The parsing is case-insensitive. 65 | */ 66 | public boolean isValid(String domain) { 67 | if (domain == null) return false; 68 | domain = unicodeToASCII(domain); 69 | // hosts must be equally reachable via punycode and Unicode; 70 | // Unicode is never shorter than punycode, so check punycode 71 | // if domain did not convert, then it will be caught by ASCII 72 | // checks in the regexes below 73 | if (domain.length() > MAX_DOMAIN_LENGTH) return false; 74 | String[] groups = domainRegex.match(domain); 75 | if (groups != null && groups.length > 0) { 76 | return isValidTld(groups[0]); 77 | } 78 | return allowLocal && hostnameRegex.isValid(domain); 79 | } 80 | 81 | public boolean isValidTld(String tld) { 82 | tld = unicodeToASCII(tld); 83 | if (allowLocal && isValidLocalTld(tld)) return true; 84 | return isValidInfrastructureTld(tld) || 85 | isValidGenericTld(tld) || 86 | isValidCountryCodeTld(tld); 87 | } 88 | 89 | /* 90 | * Returns true if the specified String matches any 91 | * IANA-defined infrastructure top-level domain. Leading dots are 92 | * ignored if present. The search is case-insensitive. 93 | */ 94 | public boolean isValidInfrastructureTld(String iTld) { 95 | final String key = chompLeadingDot(unicodeToASCII(iTld).toLowerCase(Locale.ENGLISH)); 96 | return arrayContains(INFRASTRUCTURE_TLDS, key); 97 | } 98 | 99 | /* 100 | * Returns true if the specified String matches any 101 | * IANA-defined generic top-level domain. Leading dots are ignored 102 | * if present. The search is case-insensitive. 103 | */ 104 | public boolean isValidGenericTld(String gTld) { 105 | final String key = chompLeadingDot(unicodeToASCII(gTld).toLowerCase(Locale.ENGLISH)); 106 | return (arrayContains(GENERIC_TLDS, key) || arrayContains(genericTLDsPlus, key)) && 107 | !arrayContains(genericTLDsMinus, key); 108 | } 109 | 110 | /* 111 | * Returns true if the specified String matches any 112 | * IANA-defined country code top-level domain. Leading dots are 113 | * ignored if present. The search is case-insensitive. 114 | */ 115 | public boolean isValidCountryCodeTld(String ccTld) { 116 | final String key = chompLeadingDot(unicodeToASCII(ccTld).toLowerCase(Locale.ENGLISH)); 117 | return (arrayContains(COUNTRY_CODE_TLDS, key) || arrayContains(countryCodeTLDsPlus, key)) && 118 | !arrayContains(countryCodeTLDsMinus, key); 119 | } 120 | 121 | /* 122 | * Returns true if the specified String matches any 123 | * widely used "local" domains (localhost or localdomain). Leading dots are 124 | * ignored if present. The search is case-insensitive. 125 | */ 126 | public boolean isValidLocalTld(String lTld) { 127 | final String key = chompLeadingDot(unicodeToASCII(lTld).toLowerCase(Locale.ENGLISH)); 128 | return arrayContains(LOCAL_TLDS, key); 129 | } 130 | 131 | private String chompLeadingDot(String str) { 132 | if (str.startsWith(".")) return str.substring(1); 133 | return str; 134 | } 135 | 136 | private static final String[] INFRASTRUCTURE_TLDS = new String[] { 137 | "arpa", // internet infrastructure 138 | }; 139 | 140 | private static final String[] GENERIC_TLDS = new String[] { 141 | "aaa", // aaa American Automobile Association, Inc. 142 | "aarp", // aarp AARP 143 | "abarth", // abarth Fiat Chrysler Automobiles N.V. 144 | "abb", // abb ABB Ltd 145 | "abbott", // abbott Abbott Laboratories, Inc. 146 | "abbvie", // abbvie AbbVie Inc. 147 | "abc", // abc Disney Enterprises, Inc. 148 | "able", // able Able Inc. 149 | "abogado", // abogado Top Level Domain Holdings Limited 150 | "abudhabi", // abudhabi Abu Dhabi Systems and Information Centre 151 | "academy", // academy Half Oaks, LLC 152 | "accenture", // accenture Accenture plc 153 | "accountant", // accountant dot Accountant Limited 154 | "accountants", // accountants Knob Town, LLC 155 | "aco", // aco ACO Severin Ahlmann GmbH & Co. KG 156 | "active", // active The Active Network, Inc 157 | "actor", // actor United TLD Holdco Ltd. 158 | "adac", // adac Allgemeiner Deutscher Automobil-Club e.V. (ADAC) 159 | "ads", // ads Charleston Road Registry Inc. 160 | "adult", // adult ICM Registry AD LLC 161 | "aeg", // aeg Aktiebolaget Electrolux 162 | "aero", // aero Societe Internationale de Telecommunications Aeronautique (SITA INC USA) 163 | "aetna", // aetna Aetna Life Insurance Company 164 | "afamilycompany", // afamilycompany Johnson Shareholdings, Inc. 165 | "afl", // afl Australian Football League 166 | "agakhan", // agakhan Fondation Aga Khan (Aga Khan Foundation) 167 | "agency", // agency Steel Falls, LLC 168 | "aig", // aig American International Group, Inc. 169 | "aigo", // aigo aigo Digital Technology Co,Ltd. 170 | "airbus", // airbus Airbus S.A.S. 171 | "airforce", // airforce United TLD Holdco Ltd. 172 | "airtel", // airtel Bharti Airtel Limited 173 | "akdn", // akdn Fondation Aga Khan (Aga Khan Foundation) 174 | "alfaromeo", // alfaromeo Fiat Chrysler Automobiles N.V. 175 | "alibaba", // alibaba Alibaba Group Holding Limited 176 | "alipay", // alipay Alibaba Group Holding Limited 177 | "allfinanz", // allfinanz Allfinanz Deutsche Vermögensberatung Aktiengesellschaft 178 | "allstate", // allstate Allstate Fire and Casualty Insurance Company 179 | "ally", // ally Ally Financial Inc. 180 | "alsace", // alsace REGION D ALSACE 181 | "alstom", // alstom ALSTOM 182 | "americanexpress", // americanexpress American Express Travel Related Services Company, Inc. 183 | "americanfamily", // americanfamily AmFam, Inc. 184 | "amex", // amex American Express Travel Related Services Company, Inc. 185 | "amfam", // amfam AmFam, Inc. 186 | "amica", // amica Amica Mutual Insurance Company 187 | "amsterdam", // amsterdam Gemeente Amsterdam 188 | "analytics", // analytics Campus IP LLC 189 | "android", // android Charleston Road Registry Inc. 190 | "anquan", // anquan QIHOO 360 TECHNOLOGY CO. LTD. 191 | "anz", // anz Australia and New Zealand Banking Group Limited 192 | "aol", // aol AOL Inc. 193 | "apartments", // apartments June Maple, LLC 194 | "app", // app Charleston Road Registry Inc. 195 | "apple", // apple Apple Inc. 196 | "aquarelle", // aquarelle Aquarelle.com 197 | "aramco", // aramco Aramco Services Company 198 | "archi", // archi STARTING DOT LIMITED 199 | "army", // army United TLD Holdco Ltd. 200 | "art", // art UK Creative Ideas Limited 201 | "arte", // arte Association Relative à la Télévision Européenne G.E.I.E. 202 | "asda", // asda Wal-Mart Stores, Inc. 203 | "asia", // asia DotAsia Organisation Ltd. 204 | "associates", // associates Baxter Hill, LLC 205 | "athleta", // athleta The Gap, Inc. 206 | "attorney", // attorney United TLD Holdco, Ltd 207 | "auction", // auction United TLD HoldCo, Ltd. 208 | "audi", // audi AUDI Aktiengesellschaft 209 | "audible", // audible Amazon Registry Services, Inc. 210 | "audio", // audio Uniregistry, Corp. 211 | "auspost", // auspost Australian Postal Corporation 212 | "author", // author Amazon Registry Services, Inc. 213 | "auto", // auto Uniregistry, Corp. 214 | "autos", // autos DERAutos, LLC 215 | "avianca", // avianca Aerovias del Continente Americano S.A. Avianca 216 | "aws", // aws Amazon Registry Services, Inc. 217 | "axa", // axa AXA SA 218 | "azure", // azure Microsoft Corporation 219 | "baby", // baby Johnson & Johnson Services, Inc. 220 | "baidu", // baidu Baidu, Inc. 221 | "banamex", // banamex Citigroup Inc. 222 | "bananarepublic", // bananarepublic The Gap, Inc. 223 | "band", // band United TLD Holdco, Ltd 224 | "bank", // bank fTLD Registry Services, LLC 225 | "bar", // bar Punto 2012 Sociedad Anonima Promotora de Inversion de Capital Variable 226 | "barcelona", // barcelona Municipi de Barcelona 227 | "barclaycard", // barclaycard Barclays Bank PLC 228 | "barclays", // barclays Barclays Bank PLC 229 | "barefoot", // barefoot Gallo Vineyards, Inc. 230 | "bargains", // bargains Half Hallow, LLC 231 | "baseball", // baseball MLB Advanced Media DH, LLC 232 | "basketball", // basketball Fédération Internationale de Basketball (FIBA) 233 | "bauhaus", // bauhaus Werkhaus GmbH 234 | "bayern", // bayern Bayern Connect GmbH 235 | "bbc", // bbc British Broadcasting Corporation 236 | "bbt", // bbt BB&T Corporation 237 | "bbva", // bbva BANCO BILBAO VIZCAYA ARGENTARIA, S.A. 238 | "bcg", // bcg The Boston Consulting Group, Inc. 239 | "bcn", // bcn Municipi de Barcelona 240 | "beats", // beats Beats Electronics, LLC 241 | "beauty", // beauty L'Oréal 242 | "beer", // beer Top Level Domain Holdings Limited 243 | "bentley", // bentley Bentley Motors Limited 244 | "berlin", // berlin dotBERLIN GmbH & Co. KG 245 | "best", // best BestTLD Pty Ltd 246 | "bestbuy", // bestbuy BBY Solutions, Inc. 247 | "bet", // bet Afilias plc 248 | "bharti", // bharti Bharti Enterprises (Holding) Private Limited 249 | "bible", // bible American Bible Society 250 | "bid", // bid dot Bid Limited 251 | "bike", // bike Grand Hollow, LLC 252 | "bing", // bing Microsoft Corporation 253 | "bingo", // bingo Sand Cedar, LLC 254 | "bio", // bio STARTING DOT LIMITED 255 | "biz", // biz Neustar, Inc. 256 | "black", // black Afilias Limited 257 | "blackfriday", // blackfriday Uniregistry, Corp. 258 | "blanco", // blanco BLANCO GmbH + Co KG 259 | "blockbuster", // blockbuster Dish DBS Corporation 260 | "blog", // blog Knock Knock WHOIS There, LLC 261 | "bloomberg", // bloomberg Bloomberg IP Holdings LLC 262 | "blue", // blue Afilias Limited 263 | "bms", // bms Bristol-Myers Squibb Company 264 | "bmw", // bmw Bayerische Motoren Werke Aktiengesellschaft 265 | "bnl", // bnl Banca Nazionale del Lavoro 266 | "bnpparibas", // bnpparibas BNP Paribas 267 | "boats", // boats DERBoats, LLC 268 | "boehringer", // boehringer Boehringer Ingelheim International GmbH 269 | "bofa", // bofa NMS Services, Inc. 270 | "bom", // bom Núcleo de Informação e Coordenação do Ponto BR - NIC.br 271 | "bond", // bond Bond University Limited 272 | "boo", // boo Charleston Road Registry Inc. 273 | "book", // book Amazon Registry Services, Inc. 274 | "booking", // booking Booking.com B.V. 275 | "boots", // boots THE BOOTS COMPANY PLC 276 | "bosch", // bosch Robert Bosch GMBH 277 | "bostik", // bostik Bostik SA 278 | "boston", // boston Boston TLD Management, LLC 279 | "bot", // bot Amazon Registry Services, Inc. 280 | "boutique", // boutique Over Galley, LLC 281 | "box", // box NS1 Limited 282 | "bradesco", // bradesco Banco Bradesco S.A. 283 | "bridgestone", // bridgestone Bridgestone Corporation 284 | "broadway", // broadway Celebrate Broadway, Inc. 285 | "broker", // broker DOTBROKER REGISTRY LTD 286 | "brother", // brother Brother Industries, Ltd. 287 | "brussels", // brussels DNS.be vzw 288 | "budapest", // budapest Top Level Domain Holdings Limited 289 | "bugatti", // bugatti Bugatti International SA 290 | "build", // build Plan Bee LLC 291 | "builders", // builders Atomic Madison, LLC 292 | "business", // business Spring Cross, LLC 293 | "buy", // buy Amazon Registry Services, INC 294 | "buzz", // buzz DOTSTRATEGY CO. 295 | "bzh", // bzh Association www.bzh 296 | "cab", // cab Half Sunset, LLC 297 | "cafe", // cafe Pioneer Canyon, LLC 298 | "cal", // cal Charleston Road Registry Inc. 299 | "call", // call Amazon Registry Services, Inc. 300 | "calvinklein", // calvinklein PVH gTLD Holdings LLC 301 | "cam", // cam AC Webconnecting Holding B.V. 302 | "camera", // camera Atomic Maple, LLC 303 | "camp", // camp Delta Dynamite, LLC 304 | "cancerresearch", // cancerresearch Australian Cancer Research Foundation 305 | "canon", // canon Canon Inc. 306 | "capetown", // capetown ZA Central Registry NPC trading as ZA Central Registry 307 | "capital", // capital Delta Mill, LLC 308 | "capitalone", // capitalone Capital One Financial Corporation 309 | "car", // car Cars Registry Limited 310 | "caravan", // caravan Caravan International, Inc. 311 | "cards", // cards Foggy Hollow, LLC 312 | "care", // care Goose Cross, LLC 313 | "career", // career dotCareer LLC 314 | "careers", // careers Wild Corner, LLC 315 | "cars", // cars Uniregistry, Corp. 316 | "cartier", // cartier Richemont DNS Inc. 317 | "casa", // casa Top Level Domain Holdings Limited 318 | "case", // case CNH Industrial N.V. 319 | "caseih", // caseih CNH Industrial N.V. 320 | "cash", // cash Delta Lake, LLC 321 | "casino", // casino Binky Sky, LLC 322 | "cat", // cat Fundacio puntCAT 323 | "catering", // catering New Falls. LLC 324 | "catholic", // catholic Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication) 325 | "cba", // cba COMMONWEALTH BANK OF AUSTRALIA 326 | "cbn", // cbn The Christian Broadcasting Network, Inc. 327 | "cbre", // cbre CBRE, Inc. 328 | "cbs", // cbs CBS Domains Inc. 329 | "ceb", // ceb The Corporate Executive Board Company 330 | "center", // center Tin Mill, LLC 331 | "ceo", // ceo CEOTLD Pty Ltd 332 | "cern", // cern European Organization for Nuclear Research ("CERN") 333 | "cfa", // cfa CFA Institute 334 | "cfd", // cfd DOTCFD REGISTRY LTD 335 | "chanel", // chanel Chanel International B.V. 336 | "channel", // channel Charleston Road Registry Inc. 337 | "chase", // chase JPMorgan Chase & Co. 338 | "chat", // chat Sand Fields, LLC 339 | "cheap", // cheap Sand Cover, LLC 340 | "chintai", // chintai CHINTAI Corporation 341 | "chloe", // chloe Richemont DNS Inc. 342 | "christmas", // christmas Uniregistry, Corp. 343 | "chrome", // chrome Charleston Road Registry Inc. 344 | "chrysler", // chrysler FCA US LLC. 345 | "church", // church Holly Fileds, LLC 346 | "cipriani", // cipriani Hotel Cipriani Srl 347 | "circle", // circle Amazon Registry Services, Inc. 348 | "cisco", // cisco Cisco Technology, Inc. 349 | "citadel", // citadel Citadel Domain LLC 350 | "citi", // citi Citigroup Inc. 351 | "citic", // citic CITIC Group Corporation 352 | "city", // city Snow Sky, LLC 353 | "cityeats", // cityeats Lifestyle Domain Holdings, Inc. 354 | "claims", // claims Black Corner, LLC 355 | "cleaning", // cleaning Fox Shadow, LLC 356 | "click", // click Uniregistry, Corp. 357 | "clinic", // clinic Goose Park, LLC 358 | "clinique", // clinique The Estée Lauder Companies Inc. 359 | "clothing", // clothing Steel Lake, LLC 360 | "cloud", // cloud ARUBA S.p.A. 361 | "club", // club .CLUB DOMAINS, LLC 362 | "clubmed", // clubmed Club Méditerranée S.A. 363 | "coach", // coach Koko Island, LLC 364 | "codes", // codes Puff Willow, LLC 365 | "coffee", // coffee Trixy Cover, LLC 366 | "college", // college XYZ.COM LLC 367 | "cologne", // cologne NetCologne Gesellschaft für Telekommunikation mbH 368 | "com", // com VeriSign Global Registry Services 369 | "comcast", // comcast Comcast IP Holdings I, LLC 370 | "commbank", // commbank COMMONWEALTH BANK OF AUSTRALIA 371 | "community", // community Fox Orchard, LLC 372 | "company", // company Silver Avenue, LLC 373 | "compare", // compare iSelect Ltd 374 | "computer", // computer Pine Mill, LLC 375 | "comsec", // comsec VeriSign, Inc. 376 | "condos", // condos Pine House, LLC 377 | "construction", // construction Fox Dynamite, LLC 378 | "consulting", // consulting United TLD Holdco, LTD. 379 | "contact", // contact Top Level Spectrum, Inc. 380 | "contractors", // contractors Magic Woods, LLC 381 | "cooking", // cooking Top Level Domain Holdings Limited 382 | "cookingchannel", // cookingchannel Lifestyle Domain Holdings, Inc. 383 | "cool", // cool Koko Lake, LLC 384 | "coop", // coop DotCooperation LLC 385 | "corsica", // corsica Collectivité Territoriale de Corse 386 | "country", // country Top Level Domain Holdings Limited 387 | "coupon", // coupon Amazon Registry Services, Inc. 388 | "coupons", // coupons Black Island, LLC 389 | "courses", // courses OPEN UNIVERSITIES AUSTRALIA PTY LTD 390 | "credit", // credit Snow Shadow, LLC 391 | "creditcard", // creditcard Binky Frostbite, LLC 392 | "creditunion", // creditunion CUNA Performance Resources, LLC 393 | "cricket", // cricket dot Cricket Limited 394 | "crown", // crown Crown Equipment Corporation 395 | "crs", // crs Federated Co-operatives Limited 396 | "cruise", // cruise Viking River Cruises (Bermuda) Ltd. 397 | "cruises", // cruises Spring Way, LLC 398 | "csc", // csc Alliance-One Services, Inc. 399 | "cuisinella", // cuisinella SALM S.A.S. 400 | "cymru", // cymru Nominet UK 401 | "cyou", // cyou Beijing Gamease Age Digital Technology Co., Ltd. 402 | "dabur", // dabur Dabur India Limited 403 | "dad", // dad Charleston Road Registry Inc. 404 | "dance", // dance United TLD Holdco Ltd. 405 | "data", // data Dish DBS Corporation 406 | "date", // date dot Date Limited 407 | "dating", // dating Pine Fest, LLC 408 | "datsun", // datsun NISSAN MOTOR CO., LTD. 409 | "day", // day Charleston Road Registry Inc. 410 | "dclk", // dclk Charleston Road Registry Inc. 411 | "dds", // dds Minds + Machines Group Limited 412 | "deal", // deal Amazon Registry Services, Inc. 413 | "dealer", // dealer Dealer Dot Com, Inc. 414 | "deals", // deals Sand Sunset, LLC 415 | "degree", // degree United TLD Holdco, Ltd 416 | "delivery", // delivery Steel Station, LLC 417 | "dell", // dell Dell Inc. 418 | "deloitte", // deloitte Deloitte Touche Tohmatsu 419 | "delta", // delta Delta Air Lines, Inc. 420 | "democrat", // democrat United TLD Holdco Ltd. 421 | "dental", // dental Tin Birch, LLC 422 | "dentist", // dentist United TLD Holdco, Ltd 423 | "desi", // desi Desi Networks LLC 424 | "design", // design Top Level Design, LLC 425 | "dev", // dev Charleston Road Registry Inc. 426 | "dhl", // dhl Deutsche Post AG 427 | "diamonds", // diamonds John Edge, LLC 428 | "diet", // diet Uniregistry, Corp. 429 | "digital", // digital Dash Park, LLC 430 | "direct", // direct Half Trail, LLC 431 | "directory", // directory Extra Madison, LLC 432 | "discount", // discount Holly Hill, LLC 433 | "discover", // discover Discover Financial Services 434 | "dish", // dish Dish DBS Corporation 435 | "diy", // diy Lifestyle Domain Holdings, Inc. 436 | "dnp", // dnp Dai Nippon Printing Co., Ltd. 437 | "docs", // docs Charleston Road Registry Inc. 438 | "doctor", // doctor Brice Trail, LLC 439 | "dodge", // dodge FCA US LLC. 440 | "dog", // dog Koko Mill, LLC 441 | "doha", // doha Communications Regulatory Authority (CRA) 442 | "domains", // domains Sugar Cross, LLC 443 | // "doosan", // doosan Doosan Corporation (retired) 444 | "dot", // dot Dish DBS Corporation 445 | "download", // download dot Support Limited 446 | "drive", // drive Charleston Road Registry Inc. 447 | "dtv", // dtv Dish DBS Corporation 448 | "dubai", // dubai Dubai Smart Government Department 449 | "duck", // duck Johnson Shareholdings, Inc. 450 | "dunlop", // dunlop The Goodyear Tire & Rubber Company 451 | "duns", // duns The Dun & Bradstreet Corporation 452 | "dupont", // dupont E. I. du Pont de Nemours and Company 453 | "durban", // durban ZA Central Registry NPC trading as ZA Central Registry 454 | "dvag", // dvag Deutsche Vermögensberatung Aktiengesellschaft DVAG 455 | "dvr", // dvr Hughes Satellite Systems Corporation 456 | "earth", // earth Interlink Co., Ltd. 457 | "eat", // eat Charleston Road Registry Inc. 458 | "eco", // eco Big Room Inc. 459 | "edeka", // edeka EDEKA Verband kaufmännischer Genossenschaften e.V. 460 | "edu", // edu EDUCAUSE 461 | "education", // education Brice Way, LLC 462 | "email", // email Spring Madison, LLC 463 | "emerck", // emerck Merck KGaA 464 | "energy", // energy Binky Birch, LLC 465 | "engineer", // engineer United TLD Holdco Ltd. 466 | "engineering", // engineering Romeo Canyon 467 | "enterprises", // enterprises Snow Oaks, LLC 468 | "epost", // epost Deutsche Post AG 469 | "epson", // epson Seiko Epson Corporation 470 | "equipment", // equipment Corn Station, LLC 471 | "ericsson", // ericsson Telefonaktiebolaget L M Ericsson 472 | "erni", // erni ERNI Group Holding AG 473 | "esq", // esq Charleston Road Registry Inc. 474 | "estate", // estate Trixy Park, LLC 475 | "esurance", // esurance Esurance Insurance Company 476 | "eurovision", // eurovision European Broadcasting Union (EBU) 477 | "eus", // eus Puntueus Fundazioa 478 | "events", // events Pioneer Maple, LLC 479 | "everbank", // everbank EverBank 480 | "exchange", // exchange Spring Falls, LLC 481 | "expert", // expert Magic Pass, LLC 482 | "exposed", // exposed Victor Beach, LLC 483 | "express", // express Sea Sunset, LLC 484 | "extraspace", // extraspace Extra Space Storage LLC 485 | "fage", // fage Fage International S.A. 486 | "fail", // fail Atomic Pipe, LLC 487 | "fairwinds", // fairwinds FairWinds Partners, LLC 488 | "faith", // faith dot Faith Limited 489 | "family", // family United TLD Holdco Ltd. 490 | "fan", // fan Asiamix Digital Ltd 491 | "fans", // fans Asiamix Digital Limited 492 | "farm", // farm Just Maple, LLC 493 | "farmers", // farmers Farmers Insurance Exchange 494 | "fashion", // fashion Top Level Domain Holdings Limited 495 | "fast", // fast Amazon Registry Services, Inc. 496 | "fedex", // fedex Federal Express Corporation 497 | "feedback", // feedback Top Level Spectrum, Inc. 498 | "ferrari", // ferrari Fiat Chrysler Automobiles N.V. 499 | "ferrero", // ferrero Ferrero Trading Lux S.A. 500 | "fiat", // fiat Fiat Chrysler Automobiles N.V. 501 | "fidelity", // fidelity Fidelity Brokerage Services LLC 502 | "fido", // fido Rogers Communications Canada Inc. 503 | "film", // film Motion Picture Domain Registry Pty Ltd 504 | "final", // final Núcleo de Informação e Coordenação do Ponto BR - NIC.br 505 | "finance", // finance Cotton Cypress, LLC 506 | "financial", // financial Just Cover, LLC 507 | "fire", // fire Amazon Registry Services, Inc. 508 | "firestone", // firestone Bridgestone Corporation 509 | "firmdale", // firmdale Firmdale Holdings Limited 510 | "fish", // fish Fox Woods, LLC 511 | "fishing", // fishing Top Level Domain Holdings Limited 512 | "fit", // fit Minds + Machines Group Limited 513 | "fitness", // fitness Brice Orchard, LLC 514 | "flickr", // flickr Yahoo! Domain Services Inc. 515 | "flights", // flights Fox Station, LLC 516 | "flir", // flir FLIR Systems, Inc. 517 | "florist", // florist Half Cypress, LLC 518 | "flowers", // flowers Uniregistry, Corp. 519 | // "flsmidth", // flsmidth FLSmidth A/S retired 2016-07-22 520 | "fly", // fly Charleston Road Registry Inc. 521 | "foo", // foo Charleston Road Registry Inc. 522 | "food", // food Lifestyle Domain Holdings, Inc. 523 | "foodnetwork", // foodnetwork Lifestyle Domain Holdings, Inc. 524 | "football", // football Foggy Farms, LLC 525 | "ford", // ford Ford Motor Company 526 | "forex", // forex DOTFOREX REGISTRY LTD 527 | "forsale", // forsale United TLD Holdco, LLC 528 | "forum", // forum Fegistry, LLC 529 | "foundation", // foundation John Dale, LLC 530 | "fox", // fox FOX Registry, LLC 531 | "free", // free Amazon Registry Services, Inc. 532 | "fresenius", // fresenius Fresenius Immobilien-Verwaltungs-GmbH 533 | "frl", // frl FRLregistry B.V. 534 | "frogans", // frogans OP3FT 535 | "frontdoor", // frontdoor Lifestyle Domain Holdings, Inc. 536 | "frontier", // frontier Frontier Communications Corporation 537 | "ftr", // ftr Frontier Communications Corporation 538 | "fujitsu", // fujitsu Fujitsu Limited 539 | "fujixerox", // fujixerox Xerox DNHC LLC 540 | "fun", // fun DotSpace, Inc. 541 | "fund", // fund John Castle, LLC 542 | "furniture", // furniture Lone Fields, LLC 543 | "futbol", // futbol United TLD Holdco, Ltd. 544 | "fyi", // fyi Silver Tigers, LLC 545 | "gal", // gal Asociación puntoGAL 546 | "gallery", // gallery Sugar House, LLC 547 | "gallo", // gallo Gallo Vineyards, Inc. 548 | "gallup", // gallup Gallup, Inc. 549 | "game", // game Uniregistry, Corp. 550 | "games", // games United TLD Holdco Ltd. 551 | "gap", // gap The Gap, Inc. 552 | "garden", // garden Top Level Domain Holdings Limited 553 | "gbiz", // gbiz Charleston Road Registry Inc. 554 | "gdn", // gdn Joint Stock Company "Navigation-information systems" 555 | "gea", // gea GEA Group Aktiengesellschaft 556 | "gent", // gent COMBELL GROUP NV/SA 557 | "genting", // genting Resorts World Inc. Pte. Ltd. 558 | "george", // george Wal-Mart Stores, Inc. 559 | "ggee", // ggee GMO Internet, Inc. 560 | "gift", // gift Uniregistry, Corp. 561 | "gifts", // gifts Goose Sky, LLC 562 | "gives", // gives United TLD Holdco Ltd. 563 | "giving", // giving Giving Limited 564 | "glade", // glade Johnson Shareholdings, Inc. 565 | "glass", // glass Black Cover, LLC 566 | "gle", // gle Charleston Road Registry Inc. 567 | "global", // global Dot Global Domain Registry Limited 568 | "globo", // globo Globo Comunicação e Participações S.A 569 | "gmail", // gmail Charleston Road Registry Inc. 570 | "gmbh", // gmbh Extra Dynamite, LLC 571 | "gmo", // gmo GMO Internet, Inc. 572 | "gmx", // gmx 1&1 Mail & Media GmbH 573 | "godaddy", // godaddy Go Daddy East, LLC 574 | "gold", // gold June Edge, LLC 575 | "goldpoint", // goldpoint YODOBASHI CAMERA CO.,LTD. 576 | "golf", // golf Lone Falls, LLC 577 | "goo", // goo NTT Resonant Inc. 578 | "goodhands", // goodhands Allstate Fire and Casualty Insurance Company 579 | "goodyear", // goodyear The Goodyear Tire & Rubber Company 580 | "goog", // goog Charleston Road Registry Inc. 581 | "google", // google Charleston Road Registry Inc. 582 | "gop", // gop Republican State Leadership Committee, Inc. 583 | "got", // got Amazon Registry Services, Inc. 584 | "gov", // gov General Services Administration Attn: QTDC, 2E08 (.gov Domain Registration) 585 | "grainger", // grainger Grainger Registry Services, LLC 586 | "graphics", // graphics Over Madison, LLC 587 | "gratis", // gratis Pioneer Tigers, LLC 588 | "green", // green Afilias Limited 589 | "gripe", // gripe Corn Sunset, LLC 590 | "group", // group Romeo Town, LLC 591 | "guardian", // guardian The Guardian Life Insurance Company of America 592 | "gucci", // gucci Guccio Gucci S.p.a. 593 | "guge", // guge Charleston Road Registry Inc. 594 | "guide", // guide Snow Moon, LLC 595 | "guitars", // guitars Uniregistry, Corp. 596 | "guru", // guru Pioneer Cypress, LLC 597 | "hair", // hair L'Oreal 598 | "hamburg", // hamburg Hamburg Top-Level-Domain GmbH 599 | "hangout", // hangout Charleston Road Registry Inc. 600 | "haus", // haus United TLD Holdco, LTD. 601 | "hbo", // hbo HBO Registry Services, Inc. 602 | "hdfc", // hdfc HOUSING DEVELOPMENT FINANCE CORPORATION LIMITED 603 | "hdfcbank", // hdfcbank HDFC Bank Limited 604 | "health", // health DotHealth, LLC 605 | "healthcare", // healthcare Silver Glen, LLC 606 | "help", // help Uniregistry, Corp. 607 | "helsinki", // helsinki City of Helsinki 608 | "here", // here Charleston Road Registry Inc. 609 | "hermes", // hermes Hermes International 610 | "hgtv", // hgtv Lifestyle Domain Holdings, Inc. 611 | "hiphop", // hiphop Uniregistry, Corp. 612 | "hisamitsu", // hisamitsu Hisamitsu Pharmaceutical Co.,Inc. 613 | "hitachi", // hitachi Hitachi, Ltd. 614 | "hiv", // hiv dotHIV gemeinnuetziger e.V. 615 | "hkt", // hkt PCCW-HKT DataCom Services Limited 616 | "hockey", // hockey Half Willow, LLC 617 | "holdings", // holdings John Madison, LLC 618 | "holiday", // holiday Goose Woods, LLC 619 | "homedepot", // homedepot Homer TLC, Inc. 620 | "homegoods", // homegoods The TJX Companies, Inc. 621 | "homes", // homes DERHomes, LLC 622 | "homesense", // homesense The TJX Companies, Inc. 623 | "honda", // honda Honda Motor Co., Ltd. 624 | "honeywell", // honeywell Honeywell GTLD LLC 625 | "horse", // horse Top Level Domain Holdings Limited 626 | "hospital", // hospital Ruby Pike, LLC 627 | "host", // host DotHost Inc. 628 | "hosting", // hosting Uniregistry, Corp. 629 | "hot", // hot Amazon Registry Services, Inc. 630 | "hoteles", // hoteles Travel Reservations SRL 631 | "hotmail", // hotmail Microsoft Corporation 632 | "house", // house Sugar Park, LLC 633 | "how", // how Charleston Road Registry Inc. 634 | "hsbc", // hsbc HSBC Holdings PLC 635 | "htc", // htc HTC corporation 636 | "hughes", // hughes Hughes Satellite Systems Corporation 637 | "hyatt", // hyatt Hyatt GTLD, L.L.C. 638 | "hyundai", // hyundai Hyundai Motor Company 639 | "ibm", // ibm International Business Machines Corporation 640 | "icbc", // icbc Industrial and Commercial Bank of China Limited 641 | "ice", // ice IntercontinentalExchange, Inc. 642 | "icu", // icu One.com A/S 643 | "ieee", // ieee IEEE Global LLC 644 | "ifm", // ifm ifm electronic gmbh 645 | // "iinet", // iinet Connect West Pty. Ltd. (Retired) 646 | "ikano", // ikano Ikano S.A. 647 | "imamat", // imamat Fondation Aga Khan (Aga Khan Foundation) 648 | "imdb", // imdb Amazon Registry Services, Inc. 649 | "immo", // immo Auburn Bloom, LLC 650 | "immobilien", // immobilien United TLD Holdco Ltd. 651 | "industries", // industries Outer House, LLC 652 | "infiniti", // infiniti NISSAN MOTOR CO., LTD. 653 | "info", // info Afilias Limited 654 | "ing", // ing Charleston Road Registry Inc. 655 | "ink", // ink Top Level Design, LLC 656 | "institute", // institute Outer Maple, LLC 657 | "insurance", // insurance fTLD Registry Services LLC 658 | "insure", // insure Pioneer Willow, LLC 659 | "int", // int Internet Assigned Numbers Authority 660 | "intel", // intel Intel Corporation 661 | "international", // international Wild Way, LLC 662 | "intuit", // intuit Intuit Administrative Services, Inc. 663 | "investments", // investments Holly Glen, LLC 664 | "ipiranga", // ipiranga Ipiranga Produtos de Petroleo S.A. 665 | "irish", // irish Dot-Irish LLC 666 | "iselect", // iselect iSelect Ltd 667 | "ismaili", // ismaili Fondation Aga Khan (Aga Khan Foundation) 668 | "ist", // ist Istanbul Metropolitan Municipality 669 | "istanbul", // istanbul Istanbul Metropolitan Municipality / Medya A.S. 670 | "itau", // itau Itau Unibanco Holding S.A. 671 | "itv", // itv ITV Services Limited 672 | "iveco", // iveco CNH Industrial N.V. 673 | "iwc", // iwc Richemont DNS Inc. 674 | "jaguar", // jaguar Jaguar Land Rover Ltd 675 | "java", // java Oracle Corporation 676 | "jcb", // jcb JCB Co., Ltd. 677 | "jcp", // jcp JCP Media, Inc. 678 | "jeep", // jeep FCA US LLC. 679 | "jetzt", // jetzt New TLD Company AB 680 | "jewelry", // jewelry Wild Bloom, LLC 681 | "jio", // jio Affinity Names, Inc. 682 | "jlc", // jlc Richemont DNS Inc. 683 | "jll", // jll Jones Lang LaSalle Incorporated 684 | "jmp", // jmp Matrix IP LLC 685 | "jnj", // jnj Johnson & Johnson Services, Inc. 686 | "jobs", // jobs Employ Media LLC 687 | "joburg", // joburg ZA Central Registry NPC trading as ZA Central Registry 688 | "jot", // jot Amazon Registry Services, Inc. 689 | "joy", // joy Amazon Registry Services, Inc. 690 | "jpmorgan", // jpmorgan JPMorgan Chase & Co. 691 | "jprs", // jprs Japan Registry Services Co., Ltd. 692 | "juegos", // juegos Uniregistry, Corp. 693 | "juniper", // juniper JUNIPER NETWORKS, INC. 694 | "kaufen", // kaufen United TLD Holdco Ltd. 695 | "kddi", // kddi KDDI CORPORATION 696 | "kerryhotels", // kerryhotels Kerry Trading Co. Limited 697 | "kerrylogistics", // kerrylogistics Kerry Trading Co. Limited 698 | "kerryproperties", // kerryproperties Kerry Trading Co. Limited 699 | "kfh", // kfh Kuwait Finance House 700 | "kia", // kia KIA MOTORS CORPORATION 701 | "kim", // kim Afilias Limited 702 | "kinder", // kinder Ferrero Trading Lux S.A. 703 | "kindle", // kindle Amazon Registry Services, Inc. 704 | "kitchen", // kitchen Just Goodbye, LLC 705 | "kiwi", // kiwi DOT KIWI LIMITED 706 | "koeln", // koeln NetCologne Gesellschaft für Telekommunikation mbH 707 | "komatsu", // komatsu Komatsu Ltd. 708 | "kosher", // kosher Kosher Marketing Assets LLC 709 | "kpmg", // kpmg KPMG International Cooperative (KPMG International Genossenschaft) 710 | "kpn", // kpn Koninklijke KPN N.V. 711 | "krd", // krd KRG Department of Information Technology 712 | "kred", // kred KredTLD Pty Ltd 713 | "kuokgroup", // kuokgroup Kerry Trading Co. Limited 714 | "kyoto", // kyoto Academic Institution: Kyoto Jyoho Gakuen 715 | "lacaixa", // lacaixa CAIXA D'ESTALVIS I PENSIONS DE BARCELONA 716 | "ladbrokes", // ladbrokes LADBROKES INTERNATIONAL PLC 717 | "lamborghini", // lamborghini Automobili Lamborghini S.p.A. 718 | "lamer", // lamer The Estée Lauder Companies Inc. 719 | "lancaster", // lancaster LANCASTER 720 | "lancia", // lancia Fiat Chrysler Automobiles N.V. 721 | "lancome", // lancome L'Oréal 722 | "land", // land Pine Moon, LLC 723 | "landrover", // landrover Jaguar Land Rover Ltd 724 | "lanxess", // lanxess LANXESS Corporation 725 | "lasalle", // lasalle Jones Lang LaSalle Incorporated 726 | "lat", // lat ECOM-LAC Federación de Latinoamérica y el Caribe para Internet y el Comercio Electrónico 727 | "latino", // latino Dish DBS Corporation 728 | "latrobe", // latrobe La Trobe University 729 | "law", // law Minds + Machines Group Limited 730 | "lawyer", // lawyer United TLD Holdco, Ltd 731 | "lds", // lds IRI Domain Management, LLC 732 | "lease", // lease Victor Trail, LLC 733 | "leclerc", // leclerc A.C.D. LEC Association des Centres Distributeurs Edouard Leclerc 734 | "lefrak", // lefrak LeFrak Organization, Inc. 735 | "legal", // legal Blue Falls, LLC 736 | "lego", // lego LEGO Juris A/S 737 | "lexus", // lexus TOYOTA MOTOR CORPORATION 738 | "lgbt", // lgbt Afilias Limited 739 | "liaison", // liaison Liaison Technologies, Incorporated 740 | "lidl", // lidl Schwarz Domains und Services GmbH & Co. KG 741 | "life", // life Trixy Oaks, LLC 742 | "lifeinsurance", // lifeinsurance American Council of Life Insurers 743 | "lifestyle", // lifestyle Lifestyle Domain Holdings, Inc. 744 | "lighting", // lighting John McCook, LLC 745 | "like", // like Amazon Registry Services, Inc. 746 | "lilly", // lilly Eli Lilly and Company 747 | "limited", // limited Big Fest, LLC 748 | "limo", // limo Hidden Frostbite, LLC 749 | "lincoln", // lincoln Ford Motor Company 750 | "linde", // linde Linde Aktiengesellschaft 751 | "link", // link Uniregistry, Corp. 752 | "lipsy", // lipsy Lipsy Ltd 753 | "live", // live United TLD Holdco Ltd. 754 | "living", // living Lifestyle Domain Holdings, Inc. 755 | "lixil", // lixil LIXIL Group Corporation 756 | "loan", // loan dot Loan Limited 757 | "loans", // loans June Woods, LLC 758 | "locker", // locker Dish DBS Corporation 759 | "locus", // locus Locus Analytics LLC 760 | "loft", // loft Annco, Inc. 761 | "lol", // lol Uniregistry, Corp. 762 | "london", // london Dot London Domains Limited 763 | "lotte", // lotte Lotte Holdings Co., Ltd. 764 | "lotto", // lotto Afilias Limited 765 | "love", // love Merchant Law Group LLP 766 | "lpl", // lpl LPL Holdings, Inc. 767 | "lplfinancial", // lplfinancial LPL Holdings, Inc. 768 | "ltd", // ltd Over Corner, LLC 769 | "ltda", // ltda InterNetX Corp. 770 | "lundbeck", // lundbeck H. Lundbeck A/S 771 | "lupin", // lupin LUPIN LIMITED 772 | "luxe", // luxe Top Level Domain Holdings Limited 773 | "luxury", // luxury Luxury Partners LLC 774 | "macys", // macys Macys, Inc. 775 | "madrid", // madrid Comunidad de Madrid 776 | "maif", // maif Mutuelle Assurance Instituteur France (MAIF) 777 | "maison", // maison Victor Frostbite, LLC 778 | "makeup", // makeup L'Oréal 779 | "man", // man MAN SE 780 | "management", // management John Goodbye, LLC 781 | "mango", // mango PUNTO FA S.L. 782 | "market", // market Unitied TLD Holdco, Ltd 783 | "marketing", // marketing Fern Pass, LLC 784 | "markets", // markets DOTMARKETS REGISTRY LTD 785 | "marriott", // marriott Marriott Worldwide Corporation 786 | "marshalls", // marshalls The TJX Companies, Inc. 787 | "maserati", // maserati Fiat Chrysler Automobiles N.V. 788 | "mattel", // mattel Mattel Sites, Inc. 789 | "mba", // mba Lone Hollow, LLC 790 | "mcd", // mcd McDonald’s Corporation 791 | "mcdonalds", // mcdonalds McDonald’s Corporation 792 | "mckinsey", // mckinsey McKinsey Holdings, Inc. 793 | "med", // med Medistry LLC 794 | "media", // media Grand Glen, LLC 795 | "meet", // meet Afilias Limited 796 | "melbourne", // melbourne The Crown in right of the State of Victoria, represented by its Department of State Development, Business and Innovation 797 | "meme", // meme Charleston Road Registry Inc. 798 | "memorial", // memorial Dog Beach, LLC 799 | "men", // men Exclusive Registry Limited 800 | "menu", // menu Wedding TLD2, LLC 801 | "meo", // meo PT Comunicacoes S.A. 802 | "metlife", // metlife MetLife Services and Solutions, LLC 803 | "miami", // miami Top Level Domain Holdings Limited 804 | "microsoft", // microsoft Microsoft Corporation 805 | "mil", // mil DoD Network Information Center 806 | "mini", // mini Bayerische Motoren Werke Aktiengesellschaft 807 | "mint", // mint Intuit Administrative Services, Inc. 808 | "mit", // mit Massachusetts Institute of Technology 809 | "mitsubishi", // mitsubishi Mitsubishi Corporation 810 | "mlb", // mlb MLB Advanced Media DH, LLC 811 | "mls", // mls The Canadian Real Estate Association 812 | "mma", // mma MMA IARD 813 | "mobi", // mobi Afilias Technologies Limited dba dotMobi 814 | "mobile", // mobile Dish DBS Corporation 815 | "mobily", // mobily GreenTech Consultancy Company W.L.L. 816 | "moda", // moda United TLD Holdco Ltd. 817 | "moe", // moe Interlink Co., Ltd. 818 | "moi", // moi Amazon Registry Services, Inc. 819 | "mom", // mom Uniregistry, Corp. 820 | "monash", // monash Monash University 821 | "money", // money Outer McCook, LLC 822 | "monster", // monster Monster Worldwide, Inc. 823 | "montblanc", // montblanc Richemont DNS Inc. 824 | "mopar", // mopar FCA US LLC. 825 | "mormon", // mormon IRI Domain Management, LLC ("Applicant") 826 | "mortgage", // mortgage United TLD Holdco, Ltd 827 | "moscow", // moscow Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID) 828 | "moto", // moto Motorola Trademark Holdings, LLC 829 | "motorcycles", // motorcycles DERMotorcycles, LLC 830 | "mov", // mov Charleston Road Registry Inc. 831 | "movie", // movie New Frostbite, LLC 832 | "movistar", // movistar Telefónica S.A. 833 | "msd", // msd MSD Registry Holdings, Inc. 834 | "mtn", // mtn MTN Dubai Limited 835 | "mtpc", // mtpc Mitsubishi Tanabe Pharma Corporation 836 | "mtr", // mtr MTR Corporation Limited 837 | "museum", // museum Museum Domain Management Association 838 | "mutual", // mutual Northwestern Mutual MU TLD Registry, LLC 839 | // "mutuelle", // mutuelle Fédération Nationale de la Mutualité Française (Retired) 840 | "nab", // nab National Australia Bank Limited 841 | "nadex", // nadex Nadex Domains, Inc 842 | "nagoya", // nagoya GMO Registry, Inc. 843 | "name", // name VeriSign Information Services, Inc. 844 | "nationwide", // nationwide Nationwide Mutual Insurance Company 845 | "natura", // natura NATURA COSMÉTICOS S.A. 846 | "navy", // navy United TLD Holdco Ltd. 847 | "nba", // nba NBA REGISTRY, LLC 848 | "nec", // nec NEC Corporation 849 | "net", // net VeriSign Global Registry Services 850 | "netbank", // netbank COMMONWEALTH BANK OF AUSTRALIA 851 | "netflix", // netflix Netflix, Inc. 852 | "network", // network Trixy Manor, LLC 853 | "neustar", // neustar NeuStar, Inc. 854 | "new", // new Charleston Road Registry Inc. 855 | "newholland", // newholland CNH Industrial N.V. 856 | "news", // news United TLD Holdco Ltd. 857 | "next", // next Next plc 858 | "nextdirect", // nextdirect Next plc 859 | "nexus", // nexus Charleston Road Registry Inc. 860 | "nfl", // nfl NFL Reg Ops LLC 861 | "ngo", // ngo Public Interest Registry 862 | "nhk", // nhk Japan Broadcasting Corporation (NHK) 863 | "nico", // nico DWANGO Co., Ltd. 864 | "nike", // nike NIKE, Inc. 865 | "nikon", // nikon NIKON CORPORATION 866 | "ninja", // ninja United TLD Holdco Ltd. 867 | "nissan", // nissan NISSAN MOTOR CO., LTD. 868 | "nissay", // nissay Nippon Life Insurance Company 869 | "nokia", // nokia Nokia Corporation 870 | "northwesternmutual", // northwesternmutual Northwestern Mutual Registry, LLC 871 | "norton", // norton Symantec Corporation 872 | "now", // now Amazon Registry Services, Inc. 873 | "nowruz", // nowruz Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 874 | "nowtv", // nowtv Starbucks (HK) Limited 875 | "nra", // nra NRA Holdings Company, INC. 876 | "nrw", // nrw Minds + Machines GmbH 877 | "ntt", // ntt NIPPON TELEGRAPH AND TELEPHONE CORPORATION 878 | "nyc", // nyc The City of New York by and through the New York City Department of Information Technology & Telecommunications 879 | "obi", // obi OBI Group Holding SE & Co. KGaA 880 | "observer", // observer Top Level Spectrum, Inc. 881 | "off", // off Johnson Shareholdings, Inc. 882 | "office", // office Microsoft Corporation 883 | "okinawa", // okinawa BusinessRalliart inc. 884 | "olayan", // olayan Crescent Holding GmbH 885 | "olayangroup", // olayangroup Crescent Holding GmbH 886 | "oldnavy", // oldnavy The Gap, Inc. 887 | "ollo", // ollo Dish DBS Corporation 888 | "omega", // omega The Swatch Group Ltd 889 | "one", // one One.com A/S 890 | "ong", // ong Public Interest Registry 891 | "onl", // onl I-REGISTRY Ltd., Niederlassung Deutschland 892 | "online", // online DotOnline Inc. 893 | "onyourside", // onyourside Nationwide Mutual Insurance Company 894 | "ooo", // ooo INFIBEAM INCORPORATION LIMITED 895 | "open", // open American Express Travel Related Services Company, Inc. 896 | "oracle", // oracle Oracle Corporation 897 | "orange", // orange Orange Brand Services Limited 898 | "org", // org Public Interest Registry (PIR) 899 | "organic", // organic Afilias Limited 900 | "orientexpress", // orientexpress Orient Express 901 | "origins", // origins The Estée Lauder Companies Inc. 902 | "osaka", // osaka Interlink Co., Ltd. 903 | "otsuka", // otsuka Otsuka Holdings Co., Ltd. 904 | "ott", // ott Dish DBS Corporation 905 | "ovh", // ovh OVH SAS 906 | "page", // page Charleston Road Registry Inc. 907 | "pamperedchef", // pamperedchef The Pampered Chef, Ltd. 908 | "panasonic", // panasonic Panasonic Corporation 909 | "panerai", // panerai Richemont DNS Inc. 910 | "paris", // paris City of Paris 911 | "pars", // pars Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 912 | "partners", // partners Magic Glen, LLC 913 | "parts", // parts Sea Goodbye, LLC 914 | "party", // party Blue Sky Registry Limited 915 | "passagens", // passagens Travel Reservations SRL 916 | "pay", // pay Amazon Registry Services, Inc. 917 | "pccw", // pccw PCCW Enterprises Limited 918 | "pet", // pet Afilias plc 919 | "pfizer", // pfizer Pfizer Inc. 920 | "pharmacy", // pharmacy National Association of Boards of Pharmacy 921 | "philips", // philips Koninklijke Philips N.V. 922 | "phone", // phone Dish DBS Corporation 923 | "photo", // photo Uniregistry, Corp. 924 | "photography", // photography Sugar Glen, LLC 925 | "photos", // photos Sea Corner, LLC 926 | "physio", // physio PhysBiz Pty Ltd 927 | "piaget", // piaget Richemont DNS Inc. 928 | "pics", // pics Uniregistry, Corp. 929 | "pictet", // pictet Pictet Europe S.A. 930 | "pictures", // pictures Foggy Sky, LLC 931 | "pid", // pid Top Level Spectrum, Inc. 932 | "pin", // pin Amazon Registry Services, Inc. 933 | "ping", // ping Ping Registry Provider, Inc. 934 | "pink", // pink Afilias Limited 935 | "pioneer", // pioneer Pioneer Corporation 936 | "pizza", // pizza Foggy Moon, LLC 937 | "place", // place Snow Galley, LLC 938 | "play", // play Charleston Road Registry Inc. 939 | "playstation", // playstation Sony Computer Entertainment Inc. 940 | "plumbing", // plumbing Spring Tigers, LLC 941 | "plus", // plus Sugar Mill, LLC 942 | "pnc", // pnc PNC Domain Co., LLC 943 | "pohl", // pohl Deutsche Vermögensberatung Aktiengesellschaft DVAG 944 | "poker", // poker Afilias Domains No. 5 Limited 945 | "politie", // politie Politie Nederland 946 | "porn", // porn ICM Registry PN LLC 947 | "post", // post Universal Postal Union 948 | "pramerica", // pramerica Prudential Financial, Inc. 949 | "praxi", // praxi Praxi S.p.A. 950 | "press", // press DotPress Inc. 951 | "prime", // prime Amazon Registry Services, Inc. 952 | "pro", // pro Registry Services Corporation dba RegistryPro 953 | "prod", // prod Charleston Road Registry Inc. 954 | "productions", // productions Magic Birch, LLC 955 | "prof", // prof Charleston Road Registry Inc. 956 | "progressive", // progressive Progressive Casualty Insurance Company 957 | "promo", // promo Afilias plc 958 | "properties", // properties Big Pass, LLC 959 | "property", // property Uniregistry, Corp. 960 | "protection", // protection XYZ.COM LLC 961 | "pru", // pru Prudential Financial, Inc. 962 | "prudential", // prudential Prudential Financial, Inc. 963 | "pub", // pub United TLD Holdco Ltd. 964 | "pwc", // pwc PricewaterhouseCoopers LLP 965 | "qpon", // qpon dotCOOL, Inc. 966 | "quebec", // quebec PointQuébec Inc 967 | "quest", // quest Quest ION Limited 968 | "qvc", // qvc QVC, Inc. 969 | "racing", // racing Premier Registry Limited 970 | "radio", // radio European Broadcasting Union (EBU) 971 | "raid", // raid Johnson Shareholdings, Inc. 972 | "read", // read Amazon Registry Services, Inc. 973 | "realestate", // realestate dotRealEstate LLC 974 | "realtor", // realtor Real Estate Domains LLC 975 | "realty", // realty Fegistry, LLC 976 | "recipes", // recipes Grand Island, LLC 977 | "red", // red Afilias Limited 978 | "redstone", // redstone Redstone Haute Couture Co., Ltd. 979 | "redumbrella", // redumbrella Travelers TLD, LLC 980 | "rehab", // rehab United TLD Holdco Ltd. 981 | "reise", // reise Foggy Way, LLC 982 | "reisen", // reisen New Cypress, LLC 983 | "reit", // reit National Association of Real Estate Investment Trusts, Inc. 984 | "reliance", // reliance Reliance Industries Limited 985 | "ren", // ren Beijing Qianxiang Wangjing Technology Development Co., Ltd. 986 | "rent", // rent XYZ.COM LLC 987 | "rentals", // rentals Big Hollow,LLC 988 | "repair", // repair Lone Sunset, LLC 989 | "report", // report Binky Glen, LLC 990 | "republican", // republican United TLD Holdco Ltd. 991 | "rest", // rest Punto 2012 Sociedad Anonima Promotora de Inversion de Capital Variable 992 | "restaurant", // restaurant Snow Avenue, LLC 993 | "review", // review dot Review Limited 994 | "reviews", // reviews United TLD Holdco, Ltd. 995 | "rexroth", // rexroth Robert Bosch GMBH 996 | "rich", // rich I-REGISTRY Ltd., Niederlassung Deutschland 997 | "richardli", // richardli Pacific Century Asset Management (HK) Limited 998 | "ricoh", // ricoh Ricoh Company, Ltd. 999 | "rightathome", // rightathome Johnson Shareholdings, Inc. 1000 | "ril", // ril Reliance Industries Limited 1001 | "rio", // rio Empresa Municipal de Informática SA - IPLANRIO 1002 | "rip", // rip United TLD Holdco Ltd. 1003 | "rmit", // rmit Royal Melbourne Institute of Technology 1004 | "rocher", // rocher Ferrero Trading Lux S.A. 1005 | "rocks", // rocks United TLD Holdco, LTD. 1006 | "rodeo", // rodeo Top Level Domain Holdings Limited 1007 | "rogers", // rogers Rogers Communications Canada Inc. 1008 | "room", // room Amazon Registry Services, Inc. 1009 | "rsvp", // rsvp Charleston Road Registry Inc. 1010 | "ruhr", // ruhr regiodot GmbH & Co. KG 1011 | "run", // run Snow Park, LLC 1012 | "rwe", // rwe RWE AG 1013 | "ryukyu", // ryukyu BusinessRalliart inc. 1014 | "saarland", // saarland dotSaarland GmbH 1015 | "safe", // safe Amazon Registry Services, Inc. 1016 | "safety", // safety Safety Registry Services, LLC. 1017 | "sakura", // sakura SAKURA Internet Inc. 1018 | "sale", // sale United TLD Holdco, Ltd 1019 | "salon", // salon Outer Orchard, LLC 1020 | "samsclub", // samsclub Wal-Mart Stores, Inc. 1021 | "samsung", // samsung SAMSUNG SDS CO., LTD 1022 | "sandvik", // sandvik Sandvik AB 1023 | "sandvikcoromant", // sandvikcoromant Sandvik AB 1024 | "sanofi", // sanofi Sanofi 1025 | "sap", // sap SAP AG 1026 | "sapo", // sapo PT Comunicacoes S.A. 1027 | "sarl", // sarl Delta Orchard, LLC 1028 | "sas", // sas Research IP LLC 1029 | "save", // save Amazon Registry Services, Inc. 1030 | "saxo", // saxo Saxo Bank A/S 1031 | "sbi", // sbi STATE BANK OF INDIA 1032 | "sbs", // sbs SPECIAL BROADCASTING SERVICE CORPORATION 1033 | "sca", // sca SVENSKA CELLULOSA AKTIEBOLAGET SCA (publ) 1034 | "scb", // scb The Siam Commercial Bank Public Company Limited ("SCB") 1035 | "schaeffler", // schaeffler Schaeffler Technologies AG & Co. KG 1036 | "schmidt", // schmidt SALM S.A.S. 1037 | "scholarships", // scholarships Scholarships.com, LLC 1038 | "school", // school Little Galley, LLC 1039 | "schule", // schule Outer Moon, LLC 1040 | "schwarz", // schwarz Schwarz Domains und Services GmbH & Co. KG 1041 | "science", // science dot Science Limited 1042 | "scjohnson", // scjohnson Johnson Shareholdings, Inc. 1043 | "scor", // scor SCOR SE 1044 | "scot", // scot Dot Scot Registry Limited 1045 | "seat", // seat SEAT, S.A. (Sociedad Unipersonal) 1046 | "secure", // secure Amazon Registry Services, Inc. 1047 | "security", // security XYZ.COM LLC 1048 | "seek", // seek Seek Limited 1049 | "select", // select iSelect Ltd 1050 | "sener", // sener Sener Ingeniería y Sistemas, S.A. 1051 | "services", // services Fox Castle, LLC 1052 | "ses", // ses SES 1053 | "seven", // seven Seven West Media Ltd 1054 | "sew", // sew SEW-EURODRIVE GmbH & Co KG 1055 | "sex", // sex ICM Registry SX LLC 1056 | "sexy", // sexy Uniregistry, Corp. 1057 | "sfr", // sfr Societe Francaise du Radiotelephone - SFR 1058 | "shangrila", // shangrila Shangria International Hotel Management Limited 1059 | "sharp", // sharp Sharp Corporation 1060 | "shaw", // shaw Shaw Cablesystems G.P. 1061 | "shell", // shell Shell Information Technology International Inc 1062 | "shia", // shia Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 1063 | "shiksha", // shiksha Afilias Limited 1064 | "shoes", // shoes Binky Galley, LLC 1065 | "shop", // shop GMO Registry, Inc. 1066 | "shopping", // shopping Over Keep, LLC 1067 | "shouji", // shouji QIHOO TECHNOLOGY CO. LTD. 1068 | "show", // show Snow Beach, LLC 1069 | "showtime", // showtime CBS Domains Inc. 1070 | "shriram", // shriram Shriram Capital Ltd. 1071 | "silk", // silk Amazon Registry Services, Inc. 1072 | "sina", // sina Sina Corporation 1073 | "singles", // singles Fern Madison, LLC 1074 | "site", // site DotSite Inc. 1075 | "ski", // ski STARTING DOT LIMITED 1076 | "skin", // skin L&#;Oréal 1077 | "sky", // sky Sky International AG 1078 | "skype", // skype Microsoft Corporation 1079 | "sling", // sling Hughes Satellite Systems Corporation 1080 | "smart", // smart Smart Communications, Inc. (SMART) 1081 | "smile", // smile Amazon Registry Services, Inc. 1082 | "sncf", // sncf SNCF (Société Nationale des Chemins de fer Francais) 1083 | "soccer", // soccer Foggy Shadow, LLC 1084 | "social", // social United TLD Holdco Ltd. 1085 | "softbank", // softbank SoftBank Group Corp. 1086 | "software", // software United TLD Holdco, Ltd 1087 | "sohu", // sohu Sohu.com Limited 1088 | "solar", // solar Ruby Town, LLC 1089 | "solutions", // solutions Silver Cover, LLC 1090 | "song", // song Amazon Registry Services, Inc. 1091 | "sony", // sony Sony Corporation 1092 | "soy", // soy Charleston Road Registry Inc. 1093 | "space", // space DotSpace Inc. 1094 | "spiegel", // spiegel SPIEGEL-Verlag Rudolf Augstein GmbH & Co. KG 1095 | "spot", // spot Amazon Registry Services, Inc. 1096 | "spreadbetting", // spreadbetting DOTSPREADBETTING REGISTRY LTD 1097 | "srl", // srl InterNetX Corp. 1098 | "srt", // srt FCA US LLC. 1099 | "stada", // stada STADA Arzneimittel AG 1100 | "staples", // staples Staples, Inc. 1101 | "star", // star Star India Private Limited 1102 | "starhub", // starhub StarHub Limited 1103 | "statebank", // statebank STATE BANK OF INDIA 1104 | "statefarm", // statefarm State Farm Mutual Automobile Insurance Company 1105 | "statoil", // statoil Statoil ASA 1106 | "stc", // stc Saudi Telecom Company 1107 | "stcgroup", // stcgroup Saudi Telecom Company 1108 | "stockholm", // stockholm Stockholms kommun 1109 | "storage", // storage Self Storage Company LLC 1110 | "store", // store DotStore Inc. 1111 | "stream", // stream dot Stream Limited 1112 | "studio", // studio United TLD Holdco Ltd. 1113 | "study", // study OPEN UNIVERSITIES AUSTRALIA PTY LTD 1114 | "style", // style Binky Moon, LLC 1115 | "sucks", // sucks Vox Populi Registry Ltd. 1116 | "supplies", // supplies Atomic Fields, LLC 1117 | "supply", // supply Half Falls, LLC 1118 | "support", // support Grand Orchard, LLC 1119 | "surf", // surf Top Level Domain Holdings Limited 1120 | "surgery", // surgery Tin Avenue, LLC 1121 | "suzuki", // suzuki SUZUKI MOTOR CORPORATION 1122 | "swatch", // swatch The Swatch Group Ltd 1123 | "swiftcover", // swiftcover Swiftcover Insurance Services Limited 1124 | "swiss", // swiss Swiss Confederation 1125 | "sydney", // sydney State of New South Wales, Department of Premier and Cabinet 1126 | "symantec", // symantec Symantec Corporation 1127 | "systems", // systems Dash Cypress, LLC 1128 | "tab", // tab Tabcorp Holdings Limited 1129 | "taipei", // taipei Taipei City Government 1130 | "talk", // talk Amazon Registry Services, Inc. 1131 | "taobao", // taobao Alibaba Group Holding Limited 1132 | "target", // target Target Domain Holdings, LLC 1133 | "tatamotors", // tatamotors Tata Motors Ltd 1134 | "tatar", // tatar Limited Liability Company "Coordination Center of Regional Domain of Tatarstan Republic" 1135 | "tattoo", // tattoo Uniregistry, Corp. 1136 | "tax", // tax Storm Orchard, LLC 1137 | "taxi", // taxi Pine Falls, LLC 1138 | "tci", // tci Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 1139 | "tdk", // tdk TDK Corporation 1140 | "team", // team Atomic Lake, LLC 1141 | "tech", // tech Dot Tech LLC 1142 | "technology", // technology Auburn Falls, LLC 1143 | "tel", // tel Telnic Ltd. 1144 | "telecity", // telecity TelecityGroup International Limited 1145 | "telefonica", // telefonica Telefónica S.A. 1146 | "temasek", // temasek Temasek Holdings (Private) Limited 1147 | "tennis", // tennis Cotton Bloom, LLC 1148 | "teva", // teva Teva Pharmaceutical Industries Limited 1149 | "thd", // thd Homer TLC, Inc. 1150 | "theater", // theater Blue Tigers, LLC 1151 | "theatre", // theatre XYZ.COM LLC 1152 | "tiaa", // tiaa Teachers Insurance and Annuity Association of America 1153 | "tickets", // tickets Accent Media Limited 1154 | "tienda", // tienda Victor Manor, LLC 1155 | "tiffany", // tiffany Tiffany and Company 1156 | "tips", // tips Corn Willow, LLC 1157 | "tires", // tires Dog Edge, LLC 1158 | "tirol", // tirol punkt Tirol GmbH 1159 | "tjmaxx", // tjmaxx The TJX Companies, Inc. 1160 | "tjx", // tjx The TJX Companies, Inc. 1161 | "tkmaxx", // tkmaxx The TJX Companies, Inc. 1162 | "tmall", // tmall Alibaba Group Holding Limited 1163 | "today", // today Pearl Woods, LLC 1164 | "tokyo", // tokyo GMO Registry, Inc. 1165 | "tools", // tools Pioneer North, LLC 1166 | "top", // top Jiangsu Bangning Science & Technology Co.,Ltd. 1167 | "toray", // toray Toray Industries, Inc. 1168 | "toshiba", // toshiba TOSHIBA Corporation 1169 | "total", // total Total SA 1170 | "tours", // tours Sugar Station, LLC 1171 | "town", // town Koko Moon, LLC 1172 | "toyota", // toyota TOYOTA MOTOR CORPORATION 1173 | "toys", // toys Pioneer Orchard, LLC 1174 | "trade", // trade Elite Registry Limited 1175 | "trading", // trading DOTTRADING REGISTRY LTD 1176 | "training", // training Wild Willow, LLC 1177 | "travel", // travel Tralliance Registry Management Company, LLC. 1178 | "travelchannel", // travelchannel Lifestyle Domain Holdings, Inc. 1179 | "travelers", // travelers Travelers TLD, LLC 1180 | "travelersinsurance", // travelersinsurance Travelers TLD, LLC 1181 | "trust", // trust Artemis Internet Inc 1182 | "trv", // trv Travelers TLD, LLC 1183 | "tube", // tube Latin American Telecom LLC 1184 | "tui", // tui TUI AG 1185 | "tunes", // tunes Amazon Registry Services, Inc. 1186 | "tushu", // tushu Amazon Registry Services, Inc. 1187 | "tvs", // tvs T V SUNDRAM IYENGAR & SONS PRIVATE LIMITED 1188 | "ubank", // ubank National Australia Bank Limited 1189 | "ubs", // ubs UBS AG 1190 | "uconnect", // uconnect FCA US LLC. 1191 | "unicom", // unicom China United Network Communications Corporation Limited 1192 | "university", // university Little Station, LLC 1193 | "uno", // uno Dot Latin LLC 1194 | "uol", // uol UBN INTERNET LTDA. 1195 | "ups", // ups UPS Market Driver, Inc. 1196 | "vacations", // vacations Atomic Tigers, LLC 1197 | "vana", // vana Lifestyle Domain Holdings, Inc. 1198 | "vanguard", // vanguard The Vanguard Group, Inc. 1199 | "vegas", // vegas Dot Vegas, Inc. 1200 | "ventures", // ventures Binky Lake, LLC 1201 | "verisign", // verisign VeriSign, Inc. 1202 | "versicherung", // versicherung dotversicherung-registry GmbH 1203 | "vet", // vet United TLD Holdco, Ltd 1204 | "viajes", // viajes Black Madison, LLC 1205 | "video", // video United TLD Holdco, Ltd 1206 | "vig", // vig VIENNA INSURANCE GROUP AG Wiener Versicherung Gruppe 1207 | "viking", // viking Viking River Cruises (Bermuda) Ltd. 1208 | "villas", // villas New Sky, LLC 1209 | "vin", // vin Holly Shadow, LLC 1210 | "vip", // vip Minds + Machines Group Limited 1211 | "virgin", // virgin Virgin Enterprises Limited 1212 | "visa", // visa Visa Worldwide Pte. Limited 1213 | "vision", // vision Koko Station, LLC 1214 | "vista", // vista Vistaprint Limited 1215 | "vistaprint", // vistaprint Vistaprint Limited 1216 | "viva", // viva Saudi Telecom Company 1217 | "vivo", // vivo Telefonica Brasil S.A. 1218 | "vlaanderen", // vlaanderen DNS.be vzw 1219 | "vodka", // vodka Top Level Domain Holdings Limited 1220 | "volkswagen", // volkswagen Volkswagen Group of America Inc. 1221 | "volvo", // volvo Volvo Holding Sverige Aktiebolag 1222 | "vote", // vote Monolith Registry LLC 1223 | "voting", // voting Valuetainment Corp. 1224 | "voto", // voto Monolith Registry LLC 1225 | "voyage", // voyage Ruby House, LLC 1226 | "vuelos", // vuelos Travel Reservations SRL 1227 | "wales", // wales Nominet UK 1228 | "walmart", // walmart Wal-Mart Stores, Inc. 1229 | "walter", // walter Sandvik AB 1230 | "wang", // wang Zodiac Registry Limited 1231 | "wanggou", // wanggou Amazon Registry Services, Inc. 1232 | "warman", // warman Weir Group IP Limited 1233 | "watch", // watch Sand Shadow, LLC 1234 | "watches", // watches Richemont DNS Inc. 1235 | "weather", // weather The Weather Channel, LLC 1236 | "weatherchannel", // weatherchannel The Weather Channel, LLC 1237 | "webcam", // webcam dot Webcam Limited 1238 | "weber", // weber Saint-Gobain Weber SA 1239 | "website", // website DotWebsite Inc. 1240 | "wed", // wed Atgron, Inc. 1241 | "wedding", // wedding Top Level Domain Holdings Limited 1242 | "weibo", // weibo Sina Corporation 1243 | "weir", // weir Weir Group IP Limited 1244 | "whoswho", // whoswho Who&#;s Who Registry 1245 | "wien", // wien punkt.wien GmbH 1246 | "wiki", // wiki Top Level Design, LLC 1247 | "williamhill", // williamhill William Hill Organization Limited 1248 | "win", // win First Registry Limited 1249 | "windows", // windows Microsoft Corporation 1250 | "wine", // wine June Station, LLC 1251 | "winners", // winners The TJX Companies, Inc. 1252 | "wme", // wme William Morris Endeavor Entertainment, LLC 1253 | "wolterskluwer", // wolterskluwer Wolters Kluwer N.V. 1254 | "woodside", // woodside Woodside Petroleum Limited 1255 | "work", // work Top Level Domain Holdings Limited 1256 | "works", // works Little Dynamite, LLC 1257 | "world", // world Bitter Fields, LLC 1258 | "wow", // wow Amazon Registry Services, Inc. 1259 | "wtc", // wtc World Trade Centers Association, Inc. 1260 | "wtf", // wtf Hidden Way, LLC 1261 | "xbox", // xbox Microsoft Corporation 1262 | "xerox", // xerox Xerox DNHC LLC 1263 | "xfinity", // xfinity Comcast IP Holdings I, LLC 1264 | "xihuan", // xihuan QIHOO 360 TECHNOLOGY CO. LTD. 1265 | "xin", // xin Elegant Leader Limited 1266 | "xn--11b4c3d", // कॉम VeriSign Sarl 1267 | "xn--1ck2e1b", // セール Amazon Registry Services, Inc. 1268 | "xn--1qqw23a", // 佛山 Guangzhou YU Wei Information Technology Co., Ltd. 1269 | "xn--30rr7y", // 慈善 Excellent First Limited 1270 | "xn--3bst00m", // 集团 Eagle Horizon Limited 1271 | "xn--3ds443g", // 在线 TLD REGISTRY LIMITED 1272 | "xn--3oq18vl8pn36a", // 大众汽车 Volkswagen (China) Investment Co., Ltd. 1273 | "xn--3pxu8k", // 点看 VeriSign Sarl 1274 | "xn--42c2d9a", // คอม VeriSign Sarl 1275 | "xn--45q11c", // Zodiac Scorpio Limited 1276 | "xn--4gbrim", // موقع Suhub Electronic Establishment 1277 | "xn--55qw42g", // 公益 China Organizational Name Administration Center 1278 | "xn--55qx5d", // Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center) 1279 | "xn--5su34j936bgsg", // é¦™æ ¼é‡Œæ‹‰ Shangri International Hotel Management Limited 1280 | "xn--5tzm5g", // 网站 Global Website TLD Asia Limited 1281 | "xn--6frz82g", // 移动 Afilias Limited 1282 | "xn--6qq986b3xl", // æˆ‘çˆ±ä½ Tycoon Treasure Limited 1283 | "xn--80adxhks", // Foundation for Assistance for Internet Technologies and Infrastructure Development (FAITID) 1284 | "xn--80aqecdr1a", // католик Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication) 1285 | "xn--80asehdb", // онлайн CORE Association 1286 | "xn--80aswg", // CORE Association 1287 | "xn--8y0a063a", // China United Network Communications Corporation Limited 1288 | "xn--90ae", // бг Imena.BG Plc (NAMES.BG Plc) 1289 | "xn--9dbq2a", // VeriSign Sarl 1290 | "xn--9et52u", // æ—¶å°š RISE VICTORY LIMITED 1291 | "xn--9krt00a", // Sina Corporation 1292 | "xn--b4w605ferd", // 淡马锡 Temasek Holdings (Private) Limited 1293 | "xn--bck1b9a5dre4c", // ファッション Amazon Registry Services, Inc. 1294 | "xn--c1avg", // орг Public Interest Registry 1295 | "xn--c2br7g", // नेट VeriSign Sarl 1296 | "xn--cck2b3b", // ストア Amazon Registry Services, Inc. 1297 | "xn--cg4bki", // 삼성 SAMSUNG SDS CO., LTD 1298 | "xn--czr694b", // å•†æ ‡ HU YI GLOBAL INFORMATION RESOURCES(HOLDING) COMPANY.HONGKONG LIMITED 1299 | "xn--czrs0t", // 商店 Wild Island, LLC 1300 | "xn--czru2d", // 商城 Zodiac Aquarius Limited 1301 | "xn--d1acj3b", // дети The Foundation for Network Initiatives “The Smart Internet 1302 | "xn--eckvdtc9d", // Amazon Registry Services, Inc. 1303 | "xn--efvy88h", // æ–°é—» Xinhua News Agency Guangdong Branch 1304 | "xn--estv75g", // 工行 Industrial and Commercial Bank of China Limited 1305 | "xn--fct429k", // å®¶é›» Amazon Registry Services, Inc. 1306 | "xn--fhbei", // كوم VeriSign Sarl 1307 | "xn--fiq228c5hs", // 中文网 TLD REGISTRY LIMITED 1308 | "xn--fiq64b", // 中信 CITIC Group Corporation 1309 | "xn--fjq720a", // Will Bloom, LLC 1310 | "xn--flw351e", // è°·æ­Œ Charleston Road Registry Inc. 1311 | "xn--fzys8d69uvgm", // 電訊盈科 PCCW Enterprises Limited 1312 | "xn--g2xx48c", // 购物 Minds + Machines Group Limited 1313 | "xn--gckr3f0f", // クラウド Amazon Registry Services, Inc. 1314 | "xn--gk3at1e", // 通販 Amazon Registry Services, Inc. 1315 | "xn--hxt814e", // 网店 Zodiac Libra Limited 1316 | "xn--i1b6b1a6a2e", // संगठन Public Interest Registry 1317 | "xn--imr513n", // HU YI GLOBAL INFORMATION RESOURCES (HOLDING) COMPANY. HONGKONG LIMITED 1318 | "xn--io0a7i", // 网络 Computer Network Information Center of Chinese Academy of Sciences (China Internet Network Information Center) 1319 | "xn--j1aef", // ком VeriSign Sarl 1320 | "xn--jlq61u9w7b", // 诺基亚 Nokia Corporation 1321 | "xn--jvr189m", // Amazon Registry Services, Inc. 1322 | "xn--kcrx77d1x4a", // 飞利浦 Koninklijke Philips N.V. 1323 | "xn--kpu716f", // 手表 Richemont DNS Inc. 1324 | "xn--kput3i", // 手机 Beijing RITT-Net Technology Development Co., Ltd 1325 | "xn--mgba3a3ejt", // ارامكو Aramco Services Company 1326 | "xn--mgba7c0bbn0a", // العليان Crescent Holding GmbH 1327 | "xn--mgbab2bd", // بازار CORE Association 1328 | "xn--mgbb9fbpob", // موبايلي GreenTech Consultancy Company W.L.L. 1329 | "xn--mgbca7dzdo", // ابوظبي Abu Dhabi Systems and Information Centre 1330 | "xn--mgbi4ecexp", // كاثوليك Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication) 1331 | "xn--mgbt3dhd", // همراه Asia Green IT System Bilgisayar San. ve Tic. Ltd. Sti. 1332 | "xn--mk1bu44c", // ë‹·ì»´ VeriSign Sarl 1333 | "xn--mxtq1m", // 政府 Net-Chinese Co., Ltd. 1334 | "xn--ngbc5azd", // شبكة International Domain Registry Pty. Ltd. 1335 | "xn--ngbe9e0a", // بيتك Kuwait Finance House 1336 | "xn--nqv7f", // 机构 Public Interest Registry 1337 | "xn--nqv7fs00ema", // 组织机构 Public Interest Registry 1338 | "xn--nyqy26a", // Stable Tone Limited 1339 | "xn--p1acf", // Rusnames Limited 1340 | "xn--pbt977c", // Richemont DNS Inc. 1341 | "xn--pssy2u", // 大拿 VeriSign Sarl 1342 | "xn--q9jyb4c", // Charleston Road Registry Inc. 1343 | "xn--qcka1pmc", // グーグル Charleston Road Registry Inc. 1344 | "xn--rhqv96g", // 世界 Stable Tone Limited 1345 | "xn--rovu88b", // Amazon EU S.à r.l. 1346 | "xn--ses554g", // KNET Co., Ltd 1347 | "xn--t60b56a", // ë‹·ë„· VeriSign Sarl 1348 | "xn--tckwe", // コムVeriSign Sarl 1349 | "xn--tiq49xqyj", // 天主教 Pontificium Consilium de Comunicationibus Socialibus (PCCS) (Pontifical Council for Social Communication) 1350 | "xn--unup4y", // Spring Fields, LLC 1351 | "xn--vermgensberater-ctb", // VERMöGENSBERATER Deutsche Vermögensberatung Aktiengesellschaft DVAG 1352 | "xn--vermgensberatung-pwb", // VERMöGENSBERATUNG Deutsche Vermögensberatung Aktiengesellschaft DVAG 1353 | "xn--vhquv", // Dash McCook, LLC 1354 | "xn--vuq861b", // Beijing Tele-info Network Technology Co., Ltd. 1355 | "xn--w4r85el8fhu5dnra", // 嘉里大酒店 Kerry Trading Co. Limited 1356 | "xn--w4rs40l", // 嘉里 Kerry Trading Co. Limited 1357 | "xn--xhq521b", // 广东 Guangzhou YU Wei Information Technology Co., Ltd. 1358 | "xn--zfr164b", // 政务 China Organizational Name Administration Center 1359 | "xperia", // xperia Sony Mobile Communications AB 1360 | "xxx", // xxx ICM Registry LLC 1361 | "xyz", // xyz XYZ.COM LLC 1362 | "yachts", // yachts DERYachts, LLC 1363 | "yahoo", // yahoo Yahoo! Domain Services Inc. 1364 | "yamaxun", // yamaxun Amazon Registry Services, Inc. 1365 | "yandex", // yandex YANDEX, LLC 1366 | "yodobashi", // yodobashi YODOBASHI CAMERA CO.,LTD. 1367 | "yoga", // yoga Top Level Domain Holdings Limited 1368 | "yokohama", // yokohama GMO Registry, Inc. 1369 | "you", // you Amazon Registry Services, Inc. 1370 | "youtube", // youtube Charleston Road Registry Inc. 1371 | "yun", // yun QIHOO 360 TECHNOLOGY CO. LTD. 1372 | "zappos", // zappos Amazon Registry Services, Inc. 1373 | "zara", // zara Industria de Diseño Textil, S.A. (INDITEX, S.A.) 1374 | "zero", // zero Amazon Registry Services, Inc. 1375 | "zip", // zip Charleston Road Registry Inc. 1376 | "zippo", // zippo Zadco Company 1377 | "zone", // zone Outer Falls, LLC 1378 | "zuerich", // zuerich Kanton Zürich (Canton of Zurich) 1379 | }; 1380 | 1381 | private static final String[] COUNTRY_CODE_TLDS = new String[] { 1382 | "ac", // Ascension Island 1383 | "ad", // Andorra 1384 | "ae", // United Arab Emirates 1385 | "af", // Afghanistan 1386 | "ag", // Antigua and Barbuda 1387 | "ai", // Anguilla 1388 | "al", // Albania 1389 | "am", // Armenia 1390 | // "an", // Netherlands Antilles (retired) 1391 | "ao", // Angola 1392 | "aq", // Antarctica 1393 | "ar", // Argentina 1394 | "as", // American Samoa 1395 | "at", // Austria 1396 | "au", // Australia (includes Ashmore and Cartier Islands and Coral Sea Islands) 1397 | "aw", // Aruba 1398 | "ax", // Ã…land 1399 | "az", // Azerbaijan 1400 | "ba", // Bosnia and Herzegovina 1401 | "bb", // Barbados 1402 | "bd", // Bangladesh 1403 | "be", // Belgium 1404 | "bf", // Burkina Faso 1405 | "bg", // Bulgaria 1406 | "bh", // Bahrain 1407 | "bi", // Burundi 1408 | "bj", // Benin 1409 | "bm", // Bermuda 1410 | "bn", // Brunei Darussalam 1411 | "bo", // Bolivia 1412 | "br", // Brazil 1413 | "bs", // Bahamas 1414 | "bt", // Bhutan 1415 | "bv", // Bouvet Island 1416 | "bw", // Botswana 1417 | "by", // Belarus 1418 | "bz", // Belize 1419 | "ca", // Canada 1420 | "cc", // Cocos (Keeling) Islands 1421 | "cd", // Democratic Republic of the Congo (formerly Zaire) 1422 | "cf", // Central African Republic 1423 | "cg", // Republic of the Congo 1424 | "ch", // Switzerland 1425 | "ci", // Côte d'Ivoire 1426 | "ck", // Cook Islands 1427 | "cl", // Chile 1428 | "cm", // Cameroon 1429 | "cn", // China, mainland 1430 | "co", // Colombia 1431 | "cr", // Costa Rica 1432 | "cu", // Cuba 1433 | "cv", // Cape Verde 1434 | "cw", // Curaçao 1435 | "cx", // Christmas Island 1436 | "cy", // Cyprus 1437 | "cz", // Czech Republic 1438 | "de", // Germany 1439 | "dj", // Djibouti 1440 | "dk", // Denmark 1441 | "dm", // Dominica 1442 | "do", // Dominican Republic 1443 | "dz", // Algeria 1444 | "ec", // Ecuador 1445 | "ee", // Estonia 1446 | "eg", // Egypt 1447 | "er", // Eritrea 1448 | "es", // Spain 1449 | "et", // Ethiopia 1450 | "eu", // European Union 1451 | "fi", // Finland 1452 | "fj", // Fiji 1453 | "fk", // Falkland Islands 1454 | "fm", // Federated States of Micronesia 1455 | "fo", // Faroe Islands 1456 | "fr", // France 1457 | "ga", // Gabon 1458 | "gb", // Great Britain (United Kingdom) 1459 | "gd", // Grenada 1460 | "ge", // Georgia 1461 | "gf", // French Guiana 1462 | "gg", // Guernsey 1463 | "gh", // Ghana 1464 | "gi", // Gibraltar 1465 | "gl", // Greenland 1466 | "gm", // The Gambia 1467 | "gn", // Guinea 1468 | "gp", // Guadeloupe 1469 | "gq", // Equatorial Guinea 1470 | "gr", // Greece 1471 | "gs", // South Georgia and the South Sandwich Islands 1472 | "gt", // Guatemala 1473 | "gu", // Guam 1474 | "gw", // Guinea-Bissau 1475 | "gy", // Guyana 1476 | "hk", // Hong Kong 1477 | "hm", // Heard Island and McDonald Islands 1478 | "hn", // Honduras 1479 | "hr", // Croatia (Hrvatska) 1480 | "ht", // Haiti 1481 | "hu", // Hungary 1482 | "id", // Indonesia 1483 | "ie", // Ireland (Éire) 1484 | "il", // Israel 1485 | "im", // Isle of Man 1486 | "in", // India 1487 | "io", // British Indian Ocean Territory 1488 | "iq", // Iraq 1489 | "ir", // Iran 1490 | "is", // Iceland 1491 | "it", // Italy 1492 | "je", // Jersey 1493 | "jm", // Jamaica 1494 | "jo", // Jordan 1495 | "jp", // Japan 1496 | "ke", // Kenya 1497 | "kg", // Kyrgyzstan 1498 | "kh", // Cambodia (Khmer) 1499 | "ki", // Kiribati 1500 | "km", // Comoros 1501 | "kn", // Saint Kitts and Nevis 1502 | "kp", // North Korea 1503 | "kr", // South Korea 1504 | "kw", // Kuwait 1505 | "ky", // Cayman Islands 1506 | "kz", // Kazakhstan 1507 | "la", // Laos (currently being marketed as the official domain for Los Angeles) 1508 | "lb", // Lebanon 1509 | "lc", // Saint Lucia 1510 | "li", // Liechtenstein 1511 | "lk", // Sri Lanka 1512 | "lr", // Liberia 1513 | "ls", // Lesotho 1514 | "lt", // Lithuania 1515 | "lu", // Luxembourg 1516 | "lv", // Latvia 1517 | "ly", // Libya 1518 | "ma", // Morocco 1519 | "mc", // Monaco 1520 | "md", // Moldova 1521 | "me", // Montenegro 1522 | "mg", // Madagascar 1523 | "mh", // Marshall Islands 1524 | "mk", // Republic of Macedonia 1525 | "ml", // Mali 1526 | "mm", // Myanmar 1527 | "mn", // Mongolia 1528 | "mo", // Macau 1529 | "mp", // Northern Mariana Islands 1530 | "mq", // Martinique 1531 | "mr", // Mauritania 1532 | "ms", // Montserrat 1533 | "mt", // Malta 1534 | "mu", // Mauritius 1535 | "mv", // Maldives 1536 | "mw", // Malawi 1537 | "mx", // Mexico 1538 | "my", // Malaysia 1539 | "mz", // Mozambique 1540 | "na", // Namibia 1541 | "nc", // New Caledonia 1542 | "ne", // Niger 1543 | "nf", // Norfolk Island 1544 | "ng", // Nigeria 1545 | "ni", // Nicaragua 1546 | "nl", // Netherlands 1547 | "no", // Norway 1548 | "np", // Nepal 1549 | "nr", // Nauru 1550 | "nu", // Niue 1551 | "nz", // New Zealand 1552 | "om", // Oman 1553 | "pa", // Panama 1554 | "pe", // Peru 1555 | "pf", // French Polynesia With Clipperton Island 1556 | "pg", // Papua New Guinea 1557 | "ph", // Philippines 1558 | "pk", // Pakistan 1559 | "pl", // Poland 1560 | "pm", // Saint-Pierre and Miquelon 1561 | "pn", // Pitcairn Islands 1562 | "pr", // Puerto Rico 1563 | "ps", // Palestinian territories (PA-controlled West Bank and Gaza Strip) 1564 | "pt", // Portugal 1565 | "pw", // Palau 1566 | "py", // Paraguay 1567 | "qa", // Qatar 1568 | "re", // Réunion 1569 | "ro", // Romania 1570 | "rs", // Serbia 1571 | "ru", // Russia 1572 | "rw", // Rwanda 1573 | "sa", // Saudi Arabia 1574 | "sb", // Solomon Islands 1575 | "sc", // Seychelles 1576 | "sd", // Sudan 1577 | "se", // Sweden 1578 | "sg", // Singapore 1579 | "sh", // Saint Helena 1580 | "si", // Slovenia 1581 | "sj", // Svalbard and Jan Mayen Islands Not in use (Norwegian dependencies; see .no) 1582 | "sk", // Slovakia 1583 | "sl", // Sierra Leone 1584 | "sm", // San Marino 1585 | "sn", // Senegal 1586 | "so", // Somalia 1587 | "sr", // Suriname 1588 | "st", // São Tomé and Príncipe 1589 | "su", // Soviet Union (deprecated) 1590 | "sv", // El Salvador 1591 | "sx", // Sint Maarten 1592 | "sy", // Syria 1593 | "sz", // Swaziland 1594 | "tc", // Turks and Caicos Islands 1595 | "td", // Chad 1596 | "tf", // French Southern and Antarctic Lands 1597 | "tg", // Togo 1598 | "th", // Thailand 1599 | "tj", // Tajikistan 1600 | "tk", // Tokelau 1601 | "tl", // East Timor (deprecated old code) 1602 | "tm", // Turkmenistan 1603 | "tn", // Tunisia 1604 | "to", // Tonga 1605 | // "tp", // East Timor (Retired) 1606 | "tr", // Turkey 1607 | "tt", // Trinidad and Tobago 1608 | "tv", // Tuvalu 1609 | "tw", // Taiwan, Republic of China 1610 | "tz", // Tanzania 1611 | "ua", // Ukraine 1612 | "ug", // Uganda 1613 | "uk", // United Kingdom 1614 | "us", // United States of America 1615 | "uy", // Uruguay 1616 | "uz", // Uzbekistan 1617 | "va", // Vatican City State 1618 | "vc", // Saint Vincent and the Grenadines 1619 | "ve", // Venezuela 1620 | "vg", // British Virgin Islands 1621 | "vi", // U.S. Virgin Islands 1622 | "vn", // Vietnam 1623 | "vu", // Vanuatu 1624 | "wf", // Wallis and Futuna 1625 | "ws", // Samoa (formerly Western Samoa) 1626 | "xn--3e0b707e", // 한국 KISA (Korea Internet & Security Agency) 1627 | "xn--45brj9c", // ভারত National Internet Exchange of India 1628 | "xn--54b7fta0cc", // বাংলা Posts and Telecommunications Division 1629 | "xn--80ao21a", // қаз Association of IT Companies of Kazakhstan 1630 | "xn--90a3ac", // Serbian National Internet Domain Registry (RNIDS) 1631 | "xn--90ais", // ??? Reliable Software Inc. 1632 | "xn--clchc0ea0b2g2a9gcd", // Singapore Network Information Centre (SGNIC) Pte Ltd 1633 | "xn--d1alf", // мкд Macedonian Academic Research Network Skopje 1634 | "xn--e1a4c", // ею EURid vzw/asbl 1635 | "xn--fiqs8s", // 中国 China Internet Network Information Center 1636 | "xn--fiqz9s", // 中國 China Internet Network Information Center 1637 | "xn--fpcrj9c3d", // National Internet Exchange of India 1638 | "xn--fzc2c9e2c", // LK Domain Registry 1639 | "xn--gecrj9c", // ભારત National Internet Exchange of India 1640 | "xn--h2brj9c", // भारत National Internet Exchange of India 1641 | "xn--j1amh", // укр Ukrainian Network Information Centre (UANIC), Inc. 1642 | "xn--j6w193g", // 香港 Hong Kong Internet Registration Corporation Ltd. 1643 | "xn--kprw13d", // Taiwan Network Information Center (TWNIC) 1644 | "xn--kpry57d", // Taiwan Network Information Center (TWNIC) 1645 | "xn--l1acc", // мон Datacom Co.,Ltd 1646 | "xn--lgbbat1ad8j", // الجزائر CERIST 1647 | "xn--mgb9awbf", // عمان Telecommunications Regulatory Authority (TRA) 1648 | "xn--mgba3a4f16a", // ایران Institute for Research in Fundamental Sciences (IPM) 1649 | "xn--mgbaam7a8h", // امارات Telecommunications Regulatory Authority (TRA) 1650 | "xn--mgbayh7gpa", // الاردن National Information Technology Center (NITC) 1651 | "xn--mgbbh1a71e", // بھارت National Internet Exchange of India 1652 | "xn--mgbc0a9azcg", // المغرب Agence Nationale de Réglementation des Télécommunications (ANRT) 1653 | "xn--mgberp4a5d4ar", // السعودية Communications and Information Technology Commission 1654 | "xn--mgbpl2fh", // ????? Sudan Internet Society 1655 | "xn--mgbtx2b", // عراق Communications and Media Commission (CMC) 1656 | "xn--mgbx4cd0ab", // مليسيا MYNIC Berhad 1657 | "xn--mix891f", // 澳門 Bureau of Telecommunications Regulation (DSRT) 1658 | "xn--node", // გე Information Technologies Development Center (ITDC) 1659 | "xn--o3cw4h", // ไทย Thai Network Information Center Foundation 1660 | "xn--ogbpf8fl", // سورية National Agency for Network Services (NANS) 1661 | "xn--p1ai", // рф Coordination Center for TLD RU 1662 | "xn--pgbs0dh", // تونس Agence Tunisienne d'Internet 1663 | "xn--qxam", // ελ ICS-FORTH GR 1664 | "xn--s9brj9c", // ਭਾਰਤ National Internet Exchange of India 1665 | "xn--wgbh1c", // مصر National Telecommunication Regulatory Authority - NTRA 1666 | "xn--wgbl6a", // قطر Communications Regulatory Authority 1667 | "xn--xkc2al3hye2a", // LK Domain Registry 1668 | "xn--xkc2dl3a5ee0h", // National Internet Exchange of India 1669 | "xn--y9a3aq", // ??? Internet Society 1670 | "xn--yfro4i67o", // Singapore Network Information Centre (SGNIC) Pte Ltd 1671 | "xn--ygbi2ammx", // Ministry of Telecom & Information Technology (MTIT) 1672 | "ye", // Yemen 1673 | "yt", // Mayotte 1674 | "za", // South Africa 1675 | "zm", // Zambia 1676 | "zw", // Zimbabwe 1677 | }; 1678 | 1679 | private static final String[] LOCAL_TLDS = new String[] { 1680 | "localdomain", // Also widely used as localhost.localdomain 1681 | "localhost", // RFC2606 defined 1682 | }; 1683 | 1684 | private static final String[] countryCodeTLDsPlus = EMPTY_STRING_ARRAY; 1685 | private static final String[] genericTLDsPlus = EMPTY_STRING_ARRAY; 1686 | private static final String[] countryCodeTLDsMinus = EMPTY_STRING_ARRAY; 1687 | private static final String[] genericTLDsMinus = EMPTY_STRING_ARRAY; 1688 | 1689 | /* 1690 | * Converts potentially Unicode input to punycode. 1691 | * If conversion fails, returns the original input. 1692 | */ 1693 | static String unicodeToASCII(String input) { 1694 | if (isOnlyASCII(input)) { // skip possibly expensive processing 1695 | return input; 1696 | } 1697 | try { 1698 | final String ascii = IDN.toASCII(input); 1699 | if (IDNBUGHOLDER.IDN_TOASCII_PRESERVES_TRAILING_DOTS) { 1700 | return ascii; 1701 | } 1702 | final int length = input.length(); 1703 | if (length == 0) {// check there is a last character 1704 | return input; 1705 | } 1706 | // RFC3490 3.1. 1) 1707 | // Whenever dots are used as label separators, the following 1708 | // characters MUST be recognized as dots: U+002E (full stop), U+3002 1709 | // (ideographic full stop), U+FF0E (fullwidth full stop), U+FF61 1710 | // (halfwidth ideographic full stop). 1711 | char lastChar = input.charAt(length-1);// fetch original last char 1712 | switch(lastChar) { 1713 | case '\u002E': // "." full stop 1714 | case '\u3002': // ideographic full stop 1715 | case '\uFF0E': // fullwidth full stop 1716 | case '\uFF61': // halfwidth ideographic full stop 1717 | return ascii + "."; // restore the missing stop 1718 | default: 1719 | return ascii; 1720 | } 1721 | } catch (IllegalArgumentException e) { // input is not valid 1722 | return input; 1723 | } 1724 | } 1725 | 1726 | private static class IDNBUGHOLDER { 1727 | private static boolean keepsTrailingDot() { 1728 | final String input = "a."; // must be a valid name 1729 | return input.equals(IDN.toASCII(input)); 1730 | } 1731 | private static final boolean IDN_TOASCII_PRESERVES_TRAILING_DOTS = keepsTrailingDot(); 1732 | } 1733 | 1734 | /* 1735 | * Check if input contains only ASCII 1736 | * Treats null as all ASCII 1737 | */ 1738 | private static boolean isOnlyASCII(String input) { 1739 | if (input == null) return true; 1740 | for(int i=0; i < input.length(); i++) { 1741 | if (input.charAt(i) > 0x7F) { // CHECKSTYLE IGNORE MagicNumber 1742 | return false; 1743 | } 1744 | } 1745 | return true; 1746 | } 1747 | 1748 | /* 1749 | * Check if a sorted array contains the specified key 1750 | */ 1751 | private static boolean arrayContains(String[] sortedArray, String key) { 1752 | return Arrays.binarySearch(sortedArray, key) >= 0; 1753 | } 1754 | } 1755 | --------------------------------------------------------------------------------