|
|
|
@ -89,6 +89,11 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
account := s.user.Account.(*MemoryAccount)
|
|
|
|
|
inbound := session.InboundFromContext(ctx)
|
|
|
|
|
if inbound == nil {
|
|
|
|
|
panic("no inbound metadata")
|
|
|
|
|
}
|
|
|
|
|
inbound.User = s.user
|
|
|
|
|
|
|
|
|
|
reader := buf.NewReader(conn)
|
|
|
|
|
for {
|
|
|
|
@ -126,7 +131,7 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dest := request.Destination()
|
|
|
|
|
if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Source.IsValid() {
|
|
|
|
|
if inbound.Source.IsValid() {
|
|
|
|
|
log.Record(&log.AccessMessage{
|
|
|
|
|
From: inbound.Source,
|
|
|
|
|
To: dest,
|
|
|
|
@ -136,7 +141,6 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
|
|
|
|
|
}
|
|
|
|
|
newError("tunnelling request to ", dest).WriteToLog(session.ExportIDToError(ctx))
|
|
|
|
|
|
|
|
|
|
ctx = protocol.ContextWithUser(ctx, request.User)
|
|
|
|
|
ctx = protocol.ContextWithRequestHeader(ctx, request)
|
|
|
|
|
udpServer.Dispatch(ctx, dest, data)
|
|
|
|
|
}
|
|
|
|
@ -162,6 +166,12 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
|
|
|
|
|
}
|
|
|
|
|
conn.SetReadDeadline(time.Time{})
|
|
|
|
|
|
|
|
|
|
inbound := session.InboundFromContext(ctx)
|
|
|
|
|
if inbound == nil {
|
|
|
|
|
panic("no inbound metadata")
|
|
|
|
|
}
|
|
|
|
|
inbound.User = s.user
|
|
|
|
|
|
|
|
|
|
dest := request.Destination()
|
|
|
|
|
log.Record(&log.AccessMessage{
|
|
|
|
|
From: conn.RemoteAddr(),
|
|
|
|
@ -171,8 +181,6 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
|
|
|
|
|
})
|
|
|
|
|
newError("tunnelling request to ", dest).WriteToLog(session.ExportIDToError(ctx))
|
|
|
|
|
|
|
|
|
|
ctx = protocol.ContextWithUser(ctx, request.User)
|
|
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
|
timer := signal.CancelAfterInactivity(ctx, cancel, sessionPolicy.Timeouts.ConnectionIdle)
|
|
|
|
|
|
|
|
|
|