Files
qgo-server/main.go
Smile Rex 44555c14ba
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m7s
new quic release 1
2026-03-09 23:12:28 +03:00

25 lines
834 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import (
"fmt"
"net/http"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/api/hello", func(w http.ResponseWriter, r *http.Request) {
// ВАЖНО: Этот заголовок заставляет браузер переключиться на UDP
w.Header().Set("Alt-Svc", `h3=":443"; ma=86400`)
// CORS (если нужно для Svelte)
w.Header().Set("Access-Control-Allow-Origin", "*")
// Логируем протокол. Traefik v3 передает информацию о QUIC в заголовках
fmt.Printf("Запрос от Traefik. Протокол: %s\n", r.Proto)
w.Write([]byte("Данные переданы через QUIC (UDP) до Traefik!"))
})
// Слушаем обычный порт внутри контейнера
http.ListenAndServe(":8080", mux)
}