feat: Working lease manager

This commit is contained in:
Adrian Rumpold
2022-02-20 12:47:29 +01:00
parent 9f83d6f3f5
commit 234582e586
3 changed files with 110 additions and 31 deletions

View File

@@ -1,7 +1,6 @@
package main
import (
"net"
"time"
)
@@ -197,20 +196,25 @@ const (
)
type LeaseState uint8
type TxId [4]byte
type Ipv4Addr [4]byte
type HwAddr [16]byte
var magic = [4]byte{0x63, 0x82, 0x53, 0x63}
type DhcpMessage struct {
Op DhcpOp
Htype MessageType
Hlen byte
Hops byte
Xid uint32
Xid TxId
Secs uint16
Flags uint16
Ciaddr uint32
Yiaddr uint32
Siaddr uint32
Giaddr uint32
Chaddr [16]byte
Ciaddr Ipv4Addr
Yiaddr Ipv4Addr
Siaddr Ipv4Addr
Giaddr Ipv4Addr
Chaddr HwAddr
Sname [64]byte
File [128]byte
Magic [4]byte
@@ -222,9 +226,9 @@ const (
)
type Lease struct {
TransactionId uint32
TransactionId TxId
TTL time.Time
State LeaseState
ClientAddr [16]byte
Address net.IP
ClientAddr HwAddr
Address Ipv4Addr
}