Fix an issue with ss2022 generics

This commit is contained in:
yuhan6665 2022-09-16 21:54:37 -04:00
parent 92795677f9
commit c21595a937
2 changed files with 8 additions and 4 deletions

View file

@ -119,7 +119,8 @@ func (i *MultiUserInbound) Process(ctx context.Context, network net.Network, con
func (i *MultiUserInbound) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error { func (i *MultiUserInbound) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
inbound := session.InboundFromContext(ctx) inbound := session.InboundFromContext(ctx)
user, _ := A.UserFromContext[User](ctx) userInt, _ := A.UserFromContext[int](ctx)
user := i.users[userInt]
inbound.User = &protocol.MemoryUser{ inbound.User = &protocol.MemoryUser{
Email: user.Email, Email: user.Email,
Level: uint32(user.Level), Level: uint32(user.Level),
@ -146,7 +147,8 @@ func (i *MultiUserInbound) NewConnection(ctx context.Context, conn net.Conn, met
func (i *MultiUserInbound) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error { func (i *MultiUserInbound) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
inbound := session.InboundFromContext(ctx) inbound := session.InboundFromContext(ctx)
user, _ := A.UserFromContext[User](ctx) userInt, _ := A.UserFromContext[int](ctx)
user := i.users[userInt]
inbound.User = &protocol.MemoryUser{ inbound.User = &protocol.MemoryUser{
Email: user.Email, Email: user.Email,
Level: uint32(user.Level), Level: uint32(user.Level),

View file

@ -120,7 +120,8 @@ func (i *RelayInbound) Process(ctx context.Context, network net.Network, connect
func (i *RelayInbound) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error { func (i *RelayInbound) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
inbound := session.InboundFromContext(ctx) inbound := session.InboundFromContext(ctx)
user, _ := A.UserFromContext[User](ctx) userInt, _ := A.UserFromContext[int](ctx)
user := i.destinations[userInt]
inbound.User = &protocol.MemoryUser{ inbound.User = &protocol.MemoryUser{
Email: user.Email, Email: user.Email,
Level: uint32(user.Level), Level: uint32(user.Level),
@ -147,7 +148,8 @@ func (i *RelayInbound) NewConnection(ctx context.Context, conn net.Conn, metadat
func (i *RelayInbound) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error { func (i *RelayInbound) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata M.Metadata) error {
inbound := session.InboundFromContext(ctx) inbound := session.InboundFromContext(ctx)
user, _ := A.UserFromContext[User](ctx) userInt, _ := A.UserFromContext[int](ctx)
user := i.destinations[userInt]
inbound.User = &protocol.MemoryUser{ inbound.User = &protocol.MemoryUser{
Email: user.Email, Email: user.Email,
Level: uint32(user.Level), Level: uint32(user.Level),