-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hackathon: sending beacons via connect
- Loading branch information
Showing
11 changed files
with
172 additions
and
28 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
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
21 changes: 21 additions & 0 deletions
21
patches/com_github_quic_go_quic_go/http3_remote_addr.patch
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
diff --git a/http3/server.go b/http3/server.go | ||
index ac2e32a6..a4c4e327 100644 | ||
--- a/http3/server.go | ||
+++ b/http3/server.go | ||
@@ -115,6 +115,8 @@ func (k *contextKey) String() string { return "quic-go/http3 context value " + k | ||
// type *http3.Server. | ||
var ServerContextKey = &contextKey{"http3-server"} | ||
|
||
+var RemoteAddrContextKey = &contextKey{"remote-addr"} | ||
+ | ||
type requestError struct { | ||
err error | ||
streamErr ErrCode | ||
@@ -597,6 +599,7 @@ func (s *Server) handleRequest(conn quic.Connection, str quic.Stream, decoder *q | ||
ctx := str.Context() | ||
ctx = context.WithValue(ctx, ServerContextKey, s) | ||
ctx = context.WithValue(ctx, http.LocalAddrContextKey, conn.LocalAddr()) | ||
+ ctx = context.WithValue(ctx, RemoteAddrContextKey, conn.RemoteAddr()) | ||
req = req.WithContext(ctx) | ||
r := newResponseWriter(str, conn, s.logger) | ||
if req.Method == http.MethodHead { |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("//tools/lint:go.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["dialer.go"], | ||
importpath = "github.com/scionproto/scion/pkg/connect", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/grpc:go_default_library", | ||
"//pkg/private/common:go_default_library", | ||
"//pkg/private/serrors:go_default_library", | ||
"//pkg/snet:go_default_library", | ||
"//pkg/snet/squic:go_default_library", | ||
"@com_github_quic_go_quic_go//:go_default_library", | ||
], | ||
) |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package conect | ||
|
||
import ( | ||
"context" | ||
"crypto/tls" | ||
|
||
"github.com/quic-go/quic-go" | ||
"github.com/scionproto/scion/pkg/grpc" | ||
"github.com/scionproto/scion/pkg/private/common" | ||
"github.com/scionproto/scion/pkg/private/serrors" | ||
"github.com/scionproto/scion/pkg/snet" | ||
"github.com/scionproto/scion/pkg/snet/squic" | ||
) | ||
|
||
type QUICDialer struct { | ||
Rewriter grpc.AddressRewriter | ||
Transport *quic.Transport | ||
TLSConfig *tls.Config | ||
QUICConfig *quic.Config | ||
} | ||
|
||
func (d *QUICDialer) DialEarly(ctx context.Context, _ string, _ *tls.Config, _ *quic.Config) (quic.EarlyConnection, error) { | ||
addr, _, err := d.Rewriter.RedirectToQUIC(ctx, addr) | ||
if err != nil { | ||
return nil, serrors.WrapStr("resolving SVC address", err) | ||
} | ||
if _, ok := addr.(*snet.UDPAddr); !ok { | ||
return nil, serrors.New("wrong address type after svc resolution", | ||
"type", common.TypeOf(addr)) | ||
} | ||
dialer := squic.EarlyDialer{ | ||
Addr: addr, | ||
Transport: d.Transport, | ||
TLSConfig: d.TLSConfig, | ||
QUICConfig: d.QUICConfig, | ||
} | ||
return dialer.DialEarly(ctx, "", nil, nil) | ||
} |
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