package openwrt // DhcpClient represents a dhcp client ... :) type DhcpClient struct { exec Executor iface string } // NewDhcpClient return an UCI instance to interact with UCI func NewDhcpClient(netIface string) *DhcpClient { exec := &localExecutor{} iface := netIface return &DhcpClient{exec, iface} } // NewDhcpClientWithExecutor return an UCI instance to interact with UCI func NewDhcpClientWithExecutor(netIface string, exe Executor) *DhcpClient { exec := exe iface := netIface return &DhcpClient{exec, iface} } // NewDhcpClient return an UCI instance to interact with UCI //func NewDhcpClient(netIface string, exe Executor) *DhcpClient { // var exec Executor // if exe == nil { // exec = &localExecutor{} // } else { // exec = exe // } // iface := netIface // return &DhcpClient{exec, iface} //} // AskForIP runs a dhclient ip request with udhcpc func (dc *DhcpClient) AskForIP() *CommandResult { return dc.exec.Run("udhcpc", "-i", dc.iface) }