-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor and improve HTTP server handling (#9)
* feat: refactor and improve HTTP server handling - Add type definitions for `listenAndServe` and `cleanup` in `graceful.go` - Add `appendHTTPServer` function to `Graceful` struct in `graceful.go` - Change `appendHttpServer` function to `appendHTTPServer` in `graceful.go` - Add `ReadHeaderTimeout` field to `http.Server` struct in `appendHTTPServer` function in `graceful.go` - Add tests for `TestCycle`, `TestWithFd`, `TestWithContext`, and `TestRunFd` functions in `graceful_test.go` - Change variable names and function calls in `TestCycle`, `TestWithFd`, `TestWithContext`, and `TestRunFd` functions in `graceful_test.go` - Add code for loading PEM file and creating certificate pool in `testRequest` function in `graceful_test.go` - Change `InsecureSkipVerify` field to `RootCAs` and add `MinVersion` field in `testRequest` function in `graceful_test.go` - Change variable names and function calls in `testRequest` function in `graceful_test.go` - Change variable names and function calls in `WithAddr` and `WithTLS` functions in `options.go` - Change variable names and function calls in `listen` function in `options.go` - Modify `cert.pem` and `key.pem` files in `testdata/certificate` directory Signed-off-by: Bo-Yi Wu <[email protected]> * chore: update Go version in go.mod file - Update the Go version in the go.mod file from 1.20 to 1.18 Signed-off-by: Bo-Yi Wu <[email protected]> * chore: update Go version in GitHub workflow and go.mod file - Update the `go-version` in the GitHub workflow from `^1.16` to `^1.21` - Update the `go` version in the GitHub workflow from `[1.18, 1.19, "1.20", 1.21]` to `["1.20", 1.21]` - Update the `go` version in the `go.mod` file from `go 1.18` to `go 1.20` Signed-off-by: Bo-Yi Wu <[email protected]> --------- Signed-off-by: Bo-Yi Wu <[email protected]>
- Loading branch information
Showing
6 changed files
with
104 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIC9DCCAdygAwIBAgIQUNSK+OxWHYYFxHVJV0IlpDANBgkqhkiG9w0BAQsFADAS | ||
MRAwDgYDVQQKEwdBY21lIENvMB4XDTE3MTExNjEyMDA0N1oXDTE4MTExNjEyMDA0 | ||
N1owEjEQMA4GA1UEChMHQWNtZSBDbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC | ||
AQoCggEBAKmyj/YZpD59Bpy4w3qf6VzMw9uUBsWp+IP4kl7z5cmGHYUHn/YopTLH | ||
vR23GAB12p6Km5QWzCBuJF4j61PJXHfg3/rjShZ77JcQ3kzxuy1iKDI+DNKN7Klz | ||
rdjJ49QD0lczZHeBvvCL7JsJFKFjGy62rnStuW8LaIEdtjXT+GUZTxJh6G7yPYfD | ||
MS1IsdMQGOdbGwNa+qogMuQPh0TzHw+C73myKrjY6pREijknMC/rnIMz9dLPt6Kl | ||
xXy4br443dpY6dYGIhDuKhROT+vZ05HKasuuQUFhY7v/KoUpEZMB9rfUSzjQ5fak | ||
eDUAMniXRcd+DmwvboG2TI6ixmuPK+ECAwEAAaNGMEQwDgYDVR0PAQH/BAQDAgWg | ||
MBMGA1UdJQQMMAoGCCsGAQUFBwMBMAwGA1UdEwEB/wQCMAAwDwYDVR0RBAgwBocE | ||
fwAAATANBgkqhkiG9w0BAQsFAAOCAQEAMXOLvj7BFsxdbcfRPBd0OFrH/8lI7vPV | ||
LRcJ6r5i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SJrsANOSj2VtuNU0AiN5OzOA1R6bW4cHGjkW0ZI8bXoZ+o/C1vznNNdM1weh | ||
HYJ6LQ/jr0+zrNMcCyor6unBtzcbGyi+srcT49a1ukgJas8CAwEAAaNeMFwwDgYD | ||
VR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMB8GA1UdIwQYMBaAFNGS | ||
CtAHUApzM0A9/qcM8qM3OLseMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG | ||
9w0BAQsFAAOCAYEAZol6X0NXY6d3PSVW+lZYA8O7WBuB2SMKkJZqNGCdZiW+qdYE | ||
63MwswB8PEhpQC0gofpzHzhSZHwD6rewpXQe0Tf4lZ0GTBQjRjIF1U/Cfzs/BwwO | ||
+UXgjNmBdJt9vNfmREtCBzwVEMQPYlHTbZs9PvxC58N7neBGZ48q4whnJIz7m3aH | ||
ng5hxgKxj1VMNNk1zr72c5SNJXMR1ngtohtu2uMW2duz4n6l5CXdx6GUvfrdCtYu | ||
Qa9w/DkAgNGshl71hJlJyK8/cc4yoMApI4UplvQeTDpkxzpeM7CdswvhhQd6SUvV | ||
txgp2ZRUSd/E/V8nNu3NRGM86NypvVFeyKIdb1aWLhWbnPa8+s36k0XuikZ0Cpv+ | ||
zOQ9+pEobNmrTkcmaSuXUpbxdsQQeQ8F54xPTaO8yh9nSPzzzt0KlBP3wQK0Drb7 | ||
YSwu0nK/RyCR5RUdSu56MhVfwJTnKBmmkYTjiZgOyeiI1ozPgxS0gEGDnb2JXMa8 | ||
rEcX6h/H60EN0fbQ | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEogIBAAKCAQEAqbKP9hmkPn0GnLjDep/pXMzD25QGxan4g/iSXvP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qEQH0hann0+o4TWWn9 | ||
PrYkPUAbm1k8771tVTZERR/W3Dbldr/DL5iCihe39BR2urziEEqdvkglJNntJMar | ||
TzDuIBADYQjvltb9qq4XGFBGYMLaMg+XbUVxNKEuvUdnwa4R7aZ9EfN34MwekkfA | ||
w5Cu9/GGG1ajVEfGA6PwBQKBgA3o71jGs8KFXOx7e90sivOTU5Z5fc6LTHNB0Rf7 | ||
NcJ5GmCPWRY/KZfb25AoE4B8GKDRMNt+X69zxZeZJ1KrU0rqxA02rlhyHB54gnoE | ||
G/4xMkn6/JkOC0w70PMhMBtohC7YzFOQwQEoNPT0nkno3Pl33xSLS6lPlwBo1JVj | ||
nPtZAoGACXNLXYkR5vexE+w6FGl59r4RQhu1XU8Mr5DIHeB7kXPN3RKbS201M+Tb | ||
SB5jbu0iDV477XkzSNmhaksFf2wM9MT6CaE+8n3UU5tMa+MmBGgwYTp/i9HkqVh5 | ||
jjpJifn1VWBINd4cpNzwCg9LXoo0tbtUPWwGzqVeyo/YE5GIHGo= | ||
-----END RSA PRIVATE KEY----- | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCscBEDCRWomHIt | ||
2jT5Rua5/+WyOj6Jsn/PnTzOksthzjZEJMpvdzD5skn7ZCDm3NI2fPrSI7dMA53M | ||
g88FP6OZMTbB+LruGsRGz1Z43PI2a7y+fQ3yJpNiZVOV9PhJKXIzMoYtrO/oHus7 | ||
s9QRnf65LYTO55ysxz+955GQ0WvL+lGopnYkiMRczgDwUDwL/i90T6q/+NHJjcOB | ||
figHZONFMuYQS70rYnpJtvlIJ6yVaEia7ADTko9lbbjVNAIjeTszgNUem1uHBxo5 | ||
FtGSPG16GfqPwtb85zTXTNcHoR2Cei0P469Ps6zTHAsqK+rpwbc3GxsovrK3E+PW | ||
tbpICWrPAgMBAAECggEBAJTMq9FrwHXY/wZUOsw1A5rTmHmgyyB1mNcmPzee8sQ2 | ||
dxt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