Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

FarmBot-Labs/dhcp_server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI Hex version

DHCPServer

Installation

The package can be installed by adding dhcp_server to your list of dependencies in mix.exs:

def deps do
  [{:dhcp_server, "~> 0.7"}]
end

Usage

Start and Stop a one off server

iex(1)> {:ok, dhcp_server} = DHCPServer.start_link("usb0", [])
{:ok, dhcp_server}
# Plug device in or something?
# Get ip address?
# Do some local work?
# Profit?
iex(2)> DHCPServer.stop(dhcp_server)
:ok

As part of an application startup

def start(_type, _args) do
  dhcp_options = [
    gateway: "192.168.254.1",
    netmask: "255.255.255.0",
    range: {"192.168.254.10", "192.168.254.99"},
    domain_servers: ["192.168.254.1"]
  ]

  children = [
    {DHCPServer, ["eth0", dhcp_options]}
  ]

  opts = [strategy: :one_for_one, name: MyApp.Supervisor]
  Supervisor.start_link(children, opts)
end

License

This project is originally located here and is licensed under GPLv2. See COPYING for more details.

About

DHCP Server for Elixir (fork of erlang-dhcp-server)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elixir 48.6%
  • Erlang 45.2%
  • C 3.7%
  • Makefile 2.5%