Update dependencies

- Sync with sing upstream
This commit is contained in:
yuhan6665 2022-08-27 22:40:55 -04:00
parent 2096821c07
commit 71a9a6dd55
5 changed files with 54 additions and 69 deletions

View file

@ -7,9 +7,9 @@ import (
"encoding/base64"
"strconv"
"github.com/sagernet/sing-shadowsocks"
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
C "github.com/sagernet/sing/common"
A "github.com/sagernet/sing/common/auth"
B "github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio"
E "github.com/sagernet/sing/common/exceptions"
@ -120,14 +120,13 @@ 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 {
userCtx := ctx.(*shadowsocks.UserContext[int])
inbound := session.InboundFromContext(ctx)
user := i.users[userCtx.User]
user, _ := A.UserFromContext[User](ctx)
inbound.User = &protocol.MemoryUser{
Email: user.Email,
Level: uint32(user.Level),
}
ctx = log.ContextWithAccessMessage(userCtx.Context, &log.AccessMessage{
ctx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{
From: metadata.Source,
To: metadata.Destination,
Status: log.AccessAccepted,
@ -148,14 +147,13 @@ 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 {
userCtx := ctx.(*shadowsocks.UserContext[int])
inbound := session.InboundFromContext(ctx)
user := i.users[userCtx.User]
user, _ := A.UserFromContext[User](ctx)
inbound.User = &protocol.MemoryUser{
Email: user.Email,
Level: uint32(user.Level),
}
ctx = log.ContextWithAccessMessage(userCtx.Context, &log.AccessMessage{
ctx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{
From: metadata.Source,
To: metadata.Destination,
Status: log.AccessAccepted,

View file

@ -5,9 +5,9 @@ import (
"strconv"
"strings"
"github.com/sagernet/sing-shadowsocks"
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
C "github.com/sagernet/sing/common"
A "github.com/sagernet/sing/common/auth"
B "github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio"
E "github.com/sagernet/sing/common/exceptions"
@ -119,14 +119,13 @@ 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 {
userCtx := ctx.(*shadowsocks.UserContext[int])
inbound := session.InboundFromContext(ctx)
user := i.destinations[userCtx.User]
user, _ := A.UserFromContext[User](ctx)
inbound.User = &protocol.MemoryUser{
Email: user.Email,
Level: uint32(user.Level),
}
ctx = log.ContextWithAccessMessage(userCtx.Context, &log.AccessMessage{
ctx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{
From: metadata.Source,
To: metadata.Destination,
Status: log.AccessAccepted,
@ -147,14 +146,13 @@ 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 {
userCtx := ctx.(*shadowsocks.UserContext[int])
inbound := session.InboundFromContext(ctx)
user := i.destinations[userCtx.User]
user, _ := A.UserFromContext[User](ctx)
inbound.User = &protocol.MemoryUser{
Email: user.Email,
Level: uint32(user.Level),
}
ctx = log.ContextWithAccessMessage(userCtx.Context, &log.AccessMessage{
ctx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{
From: metadata.Source,
To: metadata.Destination,
Status: log.AccessAccepted,

View file

@ -15,7 +15,7 @@ import (
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
func toDestination(socksaddr M.Socksaddr, network net.Network) net.Destination {
if socksaddr.Family().IsFqdn() {
if socksaddr.IsFqdn() {
return net.Destination{
Network: network,
Address: net.DomainAddress(socksaddr.Fqdn),