Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64ea05d

Browse files
committed
Rename channel watcher to be specific to Jetbrains
1 parent978de9a commit64ea05d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

‎agent/agentssh/agentssh.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
112112
srv:=&ssh.Server{
113113
ChannelHandlers:map[string]ssh.ChannelHandler{
114114
"direct-tcpip":func(srv*ssh.Server,conn*gossh.ServerConn,newChan gossh.NewChannel,ctx ssh.Context) {
115-
//wrapper is designed to find and trackjetbrains gateway connections.
116-
wrapped:=NewChannelAcceptWatcher(ctx,s.logger,newChan,&s.connCountJetBrains)
115+
//Wrapper is designed to find and trackJetBrains Gateway connections.
116+
wrapped:=NewJetbrainsChannelWatcher(ctx,s.logger,newChan,&s.connCountJetBrains)
117117
ssh.DirectTCPIPHandler(srv,conn,wrapped,ctx)
118118
},
119119
"direct-streamlocal@openssh.com":directStreamLocalHandler,
@@ -295,8 +295,8 @@ func (s *Server) sessionStart(logger slog.Logger, session ssh.Session, extraEnv
295295
s.connCountVSCode.Add(1)
296296
defers.connCountVSCode.Add(-1)
297297
caseMagicSessionTypeJetBrains:
298-
// Do nothing here becausejetbrains launches hundreds of ssh sessions.
299-
// We instead trackjetbrains in the single persistent tcp forwarding channel.
298+
// Do nothing here becauseJetBrains launches hundreds of ssh sessions.
299+
// We instead trackJetBrains in the single persistent tcp forwarding channel.
300300
case"":
301301
s.connCountSSHSession.Add(1)
302302
defers.connCountSSHSession.Add(-1)

‎agent/agentssh/jetbrainstrack.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ type localForwardChannelData struct {
1919
OriginPortuint32
2020
}
2121

22-
//ChannelAcceptWatcher is used to trackjetbrains portforwarding (gateway)
23-
//connections. If the port forward is something other thanjetbrains, this
24-
//structis a noop.
25-
typeChannelAcceptWatcherstruct {
22+
//JetbrainsChannelWatcher is used to trackJetBrains portforwarded (Gateway)
23+
//channels. If the port forward is something other thanJetBrains, this struct
24+
// is a noop.
25+
typeJetbrainsChannelWatcherstruct {
2626
gossh.NewChannel
2727
jetbrainsCounter*atomic.Int64
2828
}
2929

30-
funcNewChannelAcceptWatcher(ctx ssh.Context,logger slog.Logger,newChannel gossh.NewChannel,counter*atomic.Int64) gossh.NewChannel {
30+
funcNewJetbrainsChannelWatcher(ctx ssh.Context,logger slog.Logger,newChannel gossh.NewChannel,counter*atomic.Int64) gossh.NewChannel {
3131
d:=localForwardChannelData{}
3232
iferr:=gossh.Unmarshal(newChannel.ExtraData(),&d);err!=nil {
3333
// If the data fails to unmarshal, do nothing.
@@ -58,13 +58,13 @@ func NewChannelAcceptWatcher(ctx ssh.Context, logger slog.Logger, newChannel gos
5858
logger.Debug(ctx,"discovered forwarded JetBrains process",
5959
slog.F("destination_port",d.DestPort))
6060

61-
return&ChannelAcceptWatcher{
61+
return&JetbrainsChannelWatcher{
6262
NewChannel:newChannel,
6363
jetbrainsCounter:counter,
6464
}
6565
}
6666

67-
func (w*ChannelAcceptWatcher)Accept() (gossh.Channel,<-chan*gossh.Request,error) {
67+
func (w*JetbrainsChannelWatcher)Accept() (gossh.Channel,<-chan*gossh.Request,error) {
6868
c,r,err:=w.NewChannel.Accept()
6969
iferr!=nil {
7070
returnc,r,err

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp