Added Logging
All checks were successful
build-binaries / build (, amd64, linux) (push) Has been skipped
build-binaries / build (, arm, 7, linux) (push) Has been skipped
build-binaries / build (, arm64, linux) (push) Has been skipped
build-binaries / build (.exe, amd64, windows) (push) Has been skipped
build-binaries / release (push) Has been skipped
release-tag / release-image (push) Successful in 2m18s
All checks were successful
build-binaries / build (, amd64, linux) (push) Has been skipped
build-binaries / build (, arm, 7, linux) (push) Has been skipped
build-binaries / build (, arm64, linux) (push) Has been skipped
build-binaries / build (.exe, amd64, windows) (push) Has been skipped
build-binaries / release (push) Has been skipped
release-tag / release-image (push) Successful in 2m18s
This commit is contained in:
7
main.go
7
main.go
@@ -218,7 +218,7 @@ func DhcpHelperFunc(xHostname string, xDUIDs []string, xIAIDs []uint32) []payloa
|
||||
|
||||
rHostname := []rune(xHostname)
|
||||
if len(rHostname) < 6 { // 2+4
|
||||
// fallback: nimm letzte zwei Oktette 0.0
|
||||
fmt.Println("DhcpHelperFunc::1")
|
||||
qCalculatedIPv4 := Ipv4Octets[0] + "." + Ipv4Octets[1] + ".0.0"
|
||||
qCalculatedIPv6, _ := embedIPv4(qCalculatedIPv4)
|
||||
return []payloadHelper{{
|
||||
@@ -233,6 +233,7 @@ func DhcpHelperFunc(xHostname string, xDUIDs []string, xIAIDs []uint32) []payloa
|
||||
IAID: "0",
|
||||
}}
|
||||
}
|
||||
fmt.Println("DhcpHelperFunc::2")
|
||||
|
||||
qDUID := firstOrEmpty(xDUIDs)
|
||||
qSegment1 := string(rHostname[2:4])
|
||||
@@ -275,6 +276,7 @@ func getDhcp() []payloadHelper {
|
||||
for _, b := range cp {
|
||||
result = append(result, DhcpHelperFunc(b.Hostname, b.DUIDs, b.IAIDs)...)
|
||||
}
|
||||
fmt.Println("getDhcp:Result::", result)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -285,10 +287,12 @@ func register(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
var p payload
|
||||
if err := json.NewDecoder(r.Body).Decode(&p); err != nil {
|
||||
fmt.Println("register:NewDecoder::ungültiges JSON")
|
||||
http.Error(w, "ungültiges JSON", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if p.Hostname == "" {
|
||||
fmt.Println("register:Hostname::hostname fehlt")
|
||||
http.Error(w, "hostname fehlt", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
@@ -447,6 +451,7 @@ func convertRange(start, end string) ([]addrPair, error) {
|
||||
func embedIPv4(ipv4 string) (string, error) {
|
||||
ip := net.ParseIP(ipv4).To4()
|
||||
if ip == nil {
|
||||
fmt.Printf("%s ist keine gültige IPv4-Adresse", ipv4)
|
||||
return "", fmt.Errorf("%s ist keine gültige IPv4-Adresse", ipv4)
|
||||
}
|
||||
hi := uint16(ip[0])<<8 | uint16(ip[1])
|
||||
|
||||
Reference in New Issue
Block a user