refactor: remove unused ParseTLSVersion and app setter tests
- Remove sslutil.ParseTLSVersion (singular): unused, ParseTLSVersions (plural) is used - Remove TestSetPidFile and TestSetLogFile: trivial setter tests
This commit is contained in:
parent
d0867bfe3e
commit
856b46fd6d
@ -110,30 +110,6 @@ func TestNewApp(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestSetPidFile 测试 SetPidFile setter 方法。
|
||||
func TestSetPidFile(t *testing.T) {
|
||||
app := NewApp("/test/config.yaml")
|
||||
pidPath := "/var/run/lolly.pid"
|
||||
|
||||
app.SetPidFile(pidPath)
|
||||
|
||||
if app.pidFile != pidPath {
|
||||
t.Errorf("pidFile = %q, want %q", app.pidFile, pidPath)
|
||||
}
|
||||
}
|
||||
|
||||
// TestSetLogFile 测试 SetLogFile setter 方法。
|
||||
func TestSetLogFile(t *testing.T) {
|
||||
app := NewApp("/test/config.yaml")
|
||||
logPath := "/var/log/lolly.log"
|
||||
|
||||
app.SetLogFile(logPath)
|
||||
|
||||
if app.logFile != logPath {
|
||||
t.Errorf("logFile = %q, want %q", app.logFile, logPath)
|
||||
}
|
||||
}
|
||||
|
||||
// TestSigName 测试信号名称辅助函数。
|
||||
func TestSigName(t *testing.T) {
|
||||
tests := []struct {
|
||||
|
||||
@ -15,31 +15,6 @@ const (
|
||||
tlsV13Upper = "TLSV1.3"
|
||||
)
|
||||
|
||||
// ParseTLSVersion parses a TLS version string to a tls constant.
|
||||
//
|
||||
// Parameters:
|
||||
// - version: TLS version string (e.g., "TLSv1.0", "TLSv1.1", "TLSv1.2", "TLSv1.3")
|
||||
//
|
||||
// Returns:
|
||||
// - uint16: TLS version constant
|
||||
// - error: Invalid version string returns error
|
||||
func ParseTLSVersion(version string) (uint16, error) {
|
||||
switch version {
|
||||
case "TLSv1.0", "TLSV1.0":
|
||||
return tls.VersionTLS10, nil
|
||||
case "TLSv1.1", "TLSV1.1":
|
||||
return tls.VersionTLS11, nil
|
||||
case tlsV12Lower, tlsV12Upper:
|
||||
return tls.VersionTLS12, nil
|
||||
case tlsV13Lower, tlsV13Upper:
|
||||
return tls.VersionTLS13, nil
|
||||
case "":
|
||||
return 0, nil // Empty string means use default
|
||||
default:
|
||||
return 0, fmt.Errorf("invalid TLS version: %s", version)
|
||||
}
|
||||
}
|
||||
|
||||
// ParseTLSVersions parses TLS protocol version strings.
|
||||
//
|
||||
// Returns minimum and maximum TLS versions.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user