Skip to content

Commit

Permalink
clean TODO-s
Browse files Browse the repository at this point in the history
  • Loading branch information
geovex committed May 31, 2023
1 parent 19d808f commit 7d5c276
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion internal/obfuscated/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type ClientHandler struct {
client net.Conn
config *config.Config
// available after handshake
// TODO: decouple this
user *config.User
cliCtx *tgcrypt.ObfCtx
cliStream dataStream
Expand Down
6 changes: 1 addition & 5 deletions internal/obfuscated/dc.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ func LoginDC(sock io.ReadWriteCloser, protocol uint8) *rawStream {
}

func ObfuscateDC(sock io.ReadWriteCloser, ctx *tgcrypt.DcCtx) *obfuscatedStream {
// // TODO: handle negative dc
// _, err := sock.Write(ctx.Nonce[:])
// if err != nil {
// return nil, err
// }
// TODO: handle negative dc
return newObfuscatedStream(sock, ctx, &ctx.Nonce, ctx.Protocol)
}
3 changes: 1 addition & 2 deletions internal/obfuscated/middleproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ type MiddleProxyStream struct {
protoCli uint8
seq uint32
ctx *tgcrypt.MiddleCtx
// TODO: may be divide structure here
// rpcType []byte
// rpcKeySelector []byte
// rpcSchema []byte
Expand Down Expand Up @@ -434,7 +433,7 @@ func (m *MiddleProxyStream) WriteSrvMsg(msg *message) error {
fullmsg = append(fullmsg, tgcrypt.RpcProxyReqTag[:]...)
fullmsg = binary.LittleEndian.AppendUint32(fullmsg, flags)
fullmsg = append(fullmsg, m.connId[:]...)
// TODO: optional ip obfuscation
// TODO: option for obfuscation
ip6 := m.cliAddr.Addr().As16()
if m.cliAddr.Addr().Is4() {
ip6[10] = 0xff
Expand Down
4 changes: 1 addition & 3 deletions internal/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ type Stats struct {

func New() *Stats {
return &Stats{
lock: sync.RWMutex{},
// TODO: do slab here
lock: sync.RWMutex{},
clients: []*Client{},
}
}
Expand Down Expand Up @@ -48,7 +47,6 @@ func (s *Stats) AsString() string {
// generate per-user stats
userStats := map[string]int{}
fallbacks := 0
// TODO: optimize this
for _, c := range s.clients {
if c.Name != nil && *c.Name != "" {
userStats[*c.Name]++
Expand Down
3 changes: 1 addition & 2 deletions internal/tgcrypt/middle.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ type MiddleCtx struct {
AdTag []byte
Out netip.AddrPort
MP netip.AddrPort
// TODO: may be divide here
Obf *MpCtx
Obf *MpCtx
}

func NewMiddleCtx(
Expand Down

0 comments on commit 7d5c276

Please sign in to comment.