Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
dhcp4client
✓ github.com/d2g/dhcp4client
Send a DHCP request and print the assigned IP address.
package main
import (
"github.com/d2g/dhcp4client"
"log"
"net"
)
func main() {
client, err := dhcp4client.New()
if err != nil {
log.Fatal(err)
}
defer client.Close()
success, acknowledgement, err := client.Request()
if err != nil {
log.Fatal(err)
}
if success {
log.Printf("Got IP: %v\n", acknowledgement.YourIP)
}
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.0.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.