<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Server IP Check</title>
  <abstract>This specification defines a simple XMPP extension that enables a client to discover its external IP address.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##</warranty>
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>0279</number>
  <status>Deferred</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>sic</shortname>
  
  <author>
    <firstname>Peter</firstname>
    <surname>Saint-Andre</surname>
    <email>stpeter@stpeter.im</email>
    <jid>stpeter@jabber.org</jid>
    <uri>https://stpeter.im/</uri>
  </author>

  
    <author>
      <firstname>Diana</firstname>
      <surname>Cionoiu</surname>
      <email>diana@null.ro</email>
      <jid>l-fy@jabber.null.ro</jid>
    </author>

  
  <author>
    <firstname>Thiago</firstname>
    <surname>Camargo</surname>
    <email>thiago@xmppjingle.com</email>
    <jid>barata7@gmail.com</jid>
  </author>

  <revision>
    <version>0.2</version>
    <date>2013-04-17</date>
    <initials>psa</initials>
    <remark><p>Modified XML format so server can return port as well as IP address; incremented protocol version from 0 to 1.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2010-03-05</date>
    <initials>psa</initials>
    <remark><p>Initial published version.</p></remark>
  </revision>
  <revision>
    <version>0.0.2</version>
    <date>2009-03-10</date>
    <initials>psa</initials>
    <remark><p>Removed client inclusion of its IP address; added IPv6 example.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2009-03-10</date>
    <initials>psa</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>

<section1 topic="Introduction" anchor="intro">
  <p>There are times when a client might want or need to discover what its external Internet Protocol (IP) address and port are, e.g. when gathering transport candidates for protocols such as <span class="ref"><link url="https://xmpp.org/extensions/xep-0065.html">SOCKS5 Bytestreams (XEP-0065)</link></span> <note>XEP-0065: SOCKS5 Bytestreams &lt;<link url="https://xmpp.org/extensions/xep-0065.html">https://xmpp.org/extensions/xep-0065.html</link>&gt;.</note> or <span class="ref"><link url="https://xmpp.org/extensions/xep-0176.html">Jingle ICE-UDP Transport Method (XEP-0176)</link></span> <note>XEP-0176: Jingle ICE-UDP Transport Method &lt;<link url="https://xmpp.org/extensions/xep-0176.html">https://xmpp.org/extensions/xep-0176.html</link>&gt;.</note>. One way to do so is for the client to ask the XMPP server to which it has connected. This specification defines such a method. The information provided by the server cannot necessarily be relied upon because there might be intermediate entities between the client and the server, but if the IP address and port returned by the server is different from the client's notion of its IP address and port then at the very least the client has received a hint that it might be behind a network address translator (NAT) and therefore cannot usefully provide its private IP address as a candidate for use in multimedia negotiations.</p>
</section1>

<section1 topic="Protocol" anchor="proto">
  <p>First the client sends an IQ-get request to its server.</p>
  <example caption="Client requests its IP address from the server"><![CDATA[
<iq from='romeo@montague.lit/orchard'
    id='ik2s7159'
    type='get'>
  <address xmlns='urn:xmpp:sic:1'/>
</iq>
]]></example>
  <p>The server then returns an IQ-result containing an &lt;address/&gt; element containing an &lt;ip/&gt; element specifying the client's external IP address and, optionally, a &lt;port/&gt; element specifying the client's external port.</p>
  <example caption="Server returns IP address and port"><![CDATA[
<iq id='ik2s7159'
    to='romeo@montague.lit/orchard'
    type='result'>
  <address xmlns='urn:xmpp:sic:1'>
    <ip>192.168.4.1</ip>
    <port>12345</port>
</iq>
]]></example>
  <p>Note that the IP address could be IPv4 or IPv6.</p>
  <example caption="Server returns IPv6 address"><![CDATA[
<iq id='ik2s7159'
    to='romeo@montague.lit/orchard'
    type='result'>
  <address xmlns='urn:xmpp:sic:1'>
    <ip>2001:db8::9:1</ip>
    <port>12345</port>
  </address>
</iq>
]]></example>
</section1>

<section1 topic="Determining Support" anchor="support">
  <p>If an entity supports this protocol, it MUST report that by including a service discovery feature of "urn:xmpp:sic:1" in response to disco#info requests (see <link url="#ns">Protocol Namespaces</link> regarding issuance of one or more permanent namespaces).</p>
  <example caption="Service discovery information request"><![CDATA[
<iq from='romeo@montague.lit/orchard'
    id='ux71f395'
    to='montague.lit'
    type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
  <example caption="Service discovery information response"><![CDATA[
<iq from='montague.lit'
    id='ux71f395'
    to='romeo@montague.lit/orchard'
    type='result'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <feature var='urn:xmpp:sic:1'/>
  </query>
</iq>
]]></example>
</section1>

<section1 topic="Security Considerations" anchor="security">
  <p><span class="ref"><link url="http://tools.ietf.org/html/rfc6120">XMPP Core</link></span> <note>RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core &lt;<link url="http://tools.ietf.org/html/rfc6120">http://tools.ietf.org/html/rfc6120</link>&gt;.</note> specifies that client IP addresses shall not be made public. If a client requests its own IP address, that policy is not violated. However, a server MUST NOT return the IP address of another client (e.g., if a connected client sends a SIC request to the bare JID of another user); instead, it MUST return a &lt;forbidden/&gt; error.</p>
</section1>

<section1 topic="IANA Considerations" anchor="iana">
  <p>This document requires no interaction with the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>

<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <section2 topic="Protocol Namespaces" anchor="registrar-ns">
    <p>This specification defines the following XML namespace:</p>
    <ul>
      <li>urn:xmpp:sic:1</li>
    </ul>
    <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note> shall add the foregoing namespace to the registry located at &lt;<link url="https://xmpp.org/registrar/namespaces.html">https://xmpp.org/registrar/namespaces.html</link>&gt;, as described in Section 4 of <span class="ref"><link url="https://xmpp.org/extensions/xep-0053.html">XMPP Registrar Function (XEP-0053)</link></span> <note>XEP-0053: XMPP Registrar Function &lt;<link url="https://xmpp.org/extensions/xep-0053.html">https://xmpp.org/extensions/xep-0053.html</link>&gt;.</note>.</p>
  </section2>
  <section2 topic="Protocol Versioning" anchor="registrar-versioning">
    <p>If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>
  </section2>
</section1>

<section1 topic="XML Schema" anchor="schema">
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:sic:1'
    xmlns='urn:xmpp:sic:1'
    elementFormDefault='qualified'>

  <xs:element name='address' type='xs:string'/>
  <xs:element name='address'>
    <xs:complexType>
      <xs:sequence minOccurs='0'>
        <xs:element name='ip' maxOccurs='unbounded' type='xs:string'/>
        <xs:element name='port' maxOccurs='unbounded' type='xs:positiveInteger' use='optional'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
]]></code>
</section1>

<section1 topic="Acknowledgements" anchor="ack">
  <p>Thanks to Joe Hildebrand for his feedback.</p>
</section1>

</xep>
