merged with fixes
This commit is contained in:
parent
a9e758b712
commit
2f1818d656
176 changed files with 9000 additions and 907 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/iamxvbaba/td/tg"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
"telesrv/internal/transport"
|
||||
)
|
||||
|
||||
type ctxKey int
|
||||
|
|
@ -303,3 +304,15 @@ func invokeWithoutUpdatesFrom(ctx context.Context) bool {
|
|||
v, _ := ctx.Value(invokeWithoutUpdatesKey).(bool)
|
||||
return v
|
||||
}
|
||||
|
||||
// WithClientIP 在 ctx 注入客户端连接的对端 IP(来自 MTProto 连接的 RemoteAddr)。
|
||||
// 仅在需要时(绑定设备授权)由 edge 写入,其余 RPC 不依赖它。edge 通过中立
|
||||
// internal/transport 载体写入,这里仅做别名以便 rpc 业务层读取,避免反向依赖。
|
||||
func WithClientIP(ctx context.Context, ip string) context.Context {
|
||||
return transport.WithClientIP(ctx, ip)
|
||||
}
|
||||
|
||||
// ClientIPFrom 返回 ctx 中的客户端对端 IP,未设置时 ok=false。
|
||||
func ClientIPFrom(ctx context.Context) (string, bool) {
|
||||
return transport.ClientIPFrom(ctx)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue