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)
|
rHostname := []rune(xHostname)
|
||||||
if len(rHostname) < 6 { // 2+4
|
if len(rHostname) < 6 { // 2+4
|
||||||
// fallback: nimm letzte zwei Oktette 0.0
|
fmt.Println("DhcpHelperFunc::1")
|
||||||
qCalculatedIPv4 := Ipv4Octets[0] + "." + Ipv4Octets[1] + ".0.0"
|
qCalculatedIPv4 := Ipv4Octets[0] + "." + Ipv4Octets[1] + ".0.0"
|
||||||
qCalculatedIPv6, _ := embedIPv4(qCalculatedIPv4)
|
qCalculatedIPv6, _ := embedIPv4(qCalculatedIPv4)
|
||||||
return []payloadHelper{{
|
return []payloadHelper{{
|
||||||
@@ -233,6 +233,7 @@ func DhcpHelperFunc(xHostname string, xDUIDs []string, xIAIDs []uint32) []payloa
|
|||||||
IAID: "0",
|
IAID: "0",
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
fmt.Println("DhcpHelperFunc::2")
|
||||||
|
|
||||||
qDUID := firstOrEmpty(xDUIDs)
|
qDUID := firstOrEmpty(xDUIDs)
|
||||||
qSegment1 := string(rHostname[2:4])
|
qSegment1 := string(rHostname[2:4])
|
||||||
@@ -275,6 +276,7 @@ func getDhcp() []payloadHelper {
|
|||||||
for _, b := range cp {
|
for _, b := range cp {
|
||||||
result = append(result, DhcpHelperFunc(b.Hostname, b.DUIDs, b.IAIDs)...)
|
result = append(result, DhcpHelperFunc(b.Hostname, b.DUIDs, b.IAIDs)...)
|
||||||
}
|
}
|
||||||
|
fmt.Println("getDhcp:Result::", result)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,10 +287,12 @@ func register(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
var p payload
|
var p payload
|
||||||
if err := json.NewDecoder(r.Body).Decode(&p); err != nil {
|
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)
|
http.Error(w, "ungültiges JSON", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if p.Hostname == "" {
|
if p.Hostname == "" {
|
||||||
|
fmt.Println("register:Hostname::hostname fehlt")
|
||||||
http.Error(w, "hostname fehlt", http.StatusBadRequest)
|
http.Error(w, "hostname fehlt", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -447,6 +451,7 @@ func convertRange(start, end string) ([]addrPair, error) {
|
|||||||
func embedIPv4(ipv4 string) (string, error) {
|
func embedIPv4(ipv4 string) (string, error) {
|
||||||
ip := net.ParseIP(ipv4).To4()
|
ip := net.ParseIP(ipv4).To4()
|
||||||
if ip == nil {
|
if ip == nil {
|
||||||
|
fmt.Printf("%s ist keine gültige IPv4-Adresse", ipv4)
|
||||||
return "", fmt.Errorf("%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])
|
hi := uint16(ip[0])<<8 | uint16(ip[1])
|
||||||
|
|||||||
Reference in New Issue
Block a user