# InetAddress

<div class="jsdoc-content"><header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>
            <span class="ancestors"><a href="index.html">types</a>~</span>InetAddress<span class="signature">(buffer)</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>Represents an IP address.</p></div>
        
    
</header>


    
        

    
    </div>

## Constructor

<div class="jsdoc-content">
    

    
    <h4 class="name" id="InetAddress"><span class="type-signature"></span>new InetAddress<span class="signature">(buffer)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates an instance of InetAddress.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>buffer</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"><p>The buffer containing the IPv4 or IPv6 address.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L8" target="_blank" rel="noopener">types/inet-address.ts, line 8</a></p></div>













<h5>Throws:</h5>

        

    <div class="param-desc">
    
        <p>If the buffer is not a valid IPv4 or IPv6 address.</p>
    
    </div>


    







    
    

    

    

    

    

    

    

    
        </div>

## Members

<div class="jsdoc-content">

        
            
<h4 class="name" id="buffer"><span class="type-signature">(readonly) </span>buffer<span class="type-signature"></span></h4>




<div class="description">
    <p>Immutable buffer that represents the IP address</p>
</div>







<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L60" target="_blank" rel="noopener">types/inet-address.ts, line 60</a></p></div>






        
            
<h4 class="name" id="length"><span class="type-signature">(readonly) </span>length<span class="type-signature"></span></h4>




<div class="description">
    <p>Returns the length of the underlying buffer</p>
</div>







<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L36" target="_blank" rel="noopener">types/inet-address.ts, line 36</a></p></div>






        
            
<h4 class="name" id="version"><span class="type-signature">(readonly) </span>version<span class="type-signature"></span></h4>




<div class="description">
    <p>Returns the Ip version (4 or 6)</p>
</div>







<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L48" target="_blank" rel="noopener">types/inet-address.ts, line 48</a></p></div>






        
    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id=""><span class="type-signature"></span><span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Validates for a IPv4-Mapped IPv6 according to https://tools.ietf.org/html/rfc4291#section-2.5.5</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L253" target="_blank" rel="noopener">types/inet-address.ts, line 253</a></p></div>




















        
            

    

    
    <h4 class="name" id="equals"><span class="type-signature"></span>equals<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Compares 2 addresses and returns true if the underlying bytes are the same</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L146" target="_blank" rel="noopener">types/inet-address.ts, line 146</a></p></div>




















        
            

    

    
    <h4 class="name" id="getBuffer"><span class="type-signature"></span>getBuffer<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the underlying buffer</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L159" target="_blank" rel="noopener">types/inet-address.ts, line 159</a></p></div>




















        
            

    

    
    <h4 class="name" id="inspect"><span class="type-signature"></span>inspect<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Provide the name of the constructor and the string representation</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L166" target="_blank" rel="noopener">types/inet-address.ts, line 166</a></p></div>




















        
            

    

    
    <h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the string representation.
Method used by the native JSON.stringify() to serialize this instance.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L246" target="_blank" rel="noopener">types/inet-address.ts, line 246</a></p></div>




















        
            

    

    
    <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the string representation of the IP address.</p>
<p>For v4 IP addresses, a string in the form of d.d.d.d is returned.</p>
<p>For v6 IP addresses, a string in the form of x:x:x:x:x:x:x:x is returned, where the 'x's are the hexadecimal
values of the eight 16-bit pieces of the address, according to rfc5952.
In cases where there is more than one field of only zeros, it can be shortened. For example, 2001:0db8:0:0:0:1:0:1
will be expressed as 2001:0db8::1:0:1.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L180" target="_blank" rel="noopener">types/inet-address.ts, line 180</a></p></div>




















        
            

    

    
    <h4 class="name" id=".fromString"><span class="type-signature">(static) </span>fromString<span class="signature">(value)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Converts a string representation of an IP address to an InetAddress instance.</p>
<p>This function accepts both IPv4 and IPv6 addresses, which may include
an embedded IPv4 address.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/inet-address.ts#L77" target="_blank" rel="noopener">types/inet-address.ts, line 77</a></p></div>













<h5>Throws:</h5>

        

<dl>
    <dt>
        <div class="param-desc">
        <ul>
<li>If the input string is not a valid IPv4 or IPv6 address.</li>
</ul>
        </div>
    </dt>
    <dd></dd>
    <dt>
        <dl>
            <dt>
                Type
            </dt>
            <dd>
                
<span class="param-type">TypeError</span>


            </dd>
        </dl>
    </dt>
    <dd></dd>
</dl></div>
