mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-25 08:25:07 +03:00
Refactor error handling tests to use structured test cases and add address validation in server start method
This commit is contained in:
parent
170e369a53
commit
51e1ef3ed0
2 changed files with 43 additions and 31 deletions
|
@ -2,6 +2,7 @@ package webui
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -22,6 +23,13 @@ func Server(listen string, log core.Logger) *WebUIServer {
|
|||
}
|
||||
|
||||
func (w *WebUIServer) Start() error {
|
||||
// Validate listen address before starting
|
||||
if w.listen != "" {
|
||||
if _, _, err := net.SplitHostPort(w.listen); err != nil {
|
||||
return fmt.Errorf("invalid listen address: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
// Setup static files handler (implementation varies by build)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue