Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 687 Bytes

README.md

File metadata and controls

41 lines (27 loc) · 687 Bytes

Ping

A simple wrapper around gen_icmp to send raw ICMP packets from Elixir.

Installation

Add to your application dependencies to install:

def deps do
  [
    {:ping, git: "https://github.com/silverp1/elixir-ping"}
  ]
end

Usage

This is currently a very simple library - ping/1 is the only exposed function, pass it a tuple containing an IP address.

Successful response includes :ok and a map of details from gen_icmp.

Ping.ping({1,1,1,1})
{:ok, %{elapsed: 23, id: 7339, sequence: 0, ttl: 59}}

Timeout:

Ping.ping({192,168,0,1})
{:error, :timeout}

ICMP error:

{:error, :icmp_error}