ParseAddrPort replaced with ParseAddr. Removed !ap.IsValid() since it is already done in ParseAddr. Also there is no need to additionally check if an address is IPv6. If address is neither v4 or v6, then ParseAddr will return an error.
This commit is contained in:
parent
d94030a4e8
commit
345869608e
@ -45,16 +45,14 @@ func main() {
|
|||||||
network = "unix"
|
network = "unix"
|
||||||
defer os.Remove(*listenAddress)
|
defer os.Remove(*listenAddress)
|
||||||
} else {
|
} else {
|
||||||
ap, err := netip.ParseAddrPort(*listenAddress)
|
ap, err := netip.ParseAddr(*listenAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
} else if !ap.IsValid() {
|
|
||||||
log.Fatalln(*listenAddress, "is not valid")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ap.Addr().Is4() {
|
if ap.Is4() {
|
||||||
network = "tcp4"
|
network = "tcp4"
|
||||||
} else if ap.Addr().Is6() {
|
} else {
|
||||||
network = "tcp6"
|
network = "tcp6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +88,7 @@ func main() {
|
|||||||
log.Fatalf("failed to get initial size of %s: %s", *uploadDir, err)
|
log.Fatalf("failed to get initial size of %s: %s", *uploadDir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
watcha.WatchForMask(uploadDirNotify, watcher.CrDelMask)
|
go watcha.WatchForMask(uploadDirNotify, watcher.CrDelMask)
|
||||||
|
|
||||||
hand := http.NewUploadHandlers(logFile, *uploadDir, &uploadDirSize, string(hashSalt),
|
hand := http.NewUploadHandlers(logFile, *uploadDir, &uploadDirSize, string(hashSalt),
|
||||||
*keepForHours, *storageSize, *fileSizeLimit)
|
*keepForHours, *storageSize, *fileSizeLimit)
|
||||||
|
Loading…
Reference in New Issue
Block a user