mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-11 22:30:47 +01:00
* **New Features** * Multiplexed TLS port: HTTP API and a custom stream protocol can share one port via ALPN. * Agent-side TCP and DTLS/UDP stream tunneling with health-check support and runtime capability detection. * Agents now advertise per-agent stream support (TCP/UDP). * **Documentation** * Added comprehensive stream protocol documentation. * **Tests** * Extended integration and concurrency tests covering multiplexing, TCP/UDP streams, and health checks. * **Chores** * Compose/template updated to expose both TCP and UDP ports.
27 lines
582 B
Go
27 lines
582 B
Go
package stream
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestStreamRequestHeader_RoundTripAndChecksum(t *testing.T) {
|
|
h, err := NewStreamRequestHeader("example.com", "443")
|
|
if err != nil {
|
|
t.Fatalf("NewStreamRequestHeader: %v", err)
|
|
}
|
|
if !h.Validate() {
|
|
t.Fatalf("expected header to validate")
|
|
}
|
|
|
|
var buf [headerSize]byte
|
|
copy(buf[:], h.Bytes())
|
|
h2 := ToHeader(&buf)
|
|
if !h2.Validate() {
|
|
t.Fatalf("expected round-tripped header to validate")
|
|
}
|
|
host, port := h2.GetHostPort()
|
|
if host != "example.com" || port != "443" {
|
|
t.Fatalf("unexpected host/port: %q:%q", host, port)
|
|
}
|
|
}
|