hysteria 2 prototype first public release

This commit is contained in:
tobyxdd
2023-05-25 20:24:24 -07:00
parent c0ab06e961
commit 9f54aade8f
139 changed files with 5146 additions and 11657 deletions

View File

@@ -0,0 +1,36 @@
package protocol
import (
"net/http"
"strconv"
)
const (
URLHost = "hysteria"
URLPath = "/auth"
HeaderAuth = "Hysteria-Auth"
HeaderCCRX = "Hysteria-CC-RX"
StatusAuthOK = 233
)
func AuthRequestDataFromHeader(h http.Header) (auth string, rx uint64) {
auth = h.Get(HeaderAuth)
rx, _ = strconv.ParseUint(h.Get(HeaderCCRX), 10, 64)
return
}
func AuthRequestDataToHeader(h http.Header, auth string, rx uint64) {
h.Set(HeaderAuth, auth)
h.Set(HeaderCCRX, strconv.FormatUint(rx, 10))
}
func AuthResponseDataFromHeader(h http.Header) (rx uint64) {
rx, _ = strconv.ParseUint(h.Get(HeaderCCRX), 10, 64)
return
}
func AuthResponseDataToHeader(h http.Header, rx uint64) {
h.Set(HeaderCCRX, strconv.FormatUint(rx, 10))
}