Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@virusvfv
Copy link
Contributor

@virusvfv virusvfv commented Jul 9, 2024

Hi again )
According previous talks I re-coded websocket branch again with your last ligolo-ng commits.
This commit adds websocket with http-proxy support.
So U can easier view this PR.
Thanks and regads !!

host, _, err := net.SplitHostPort(*serverAddr)
if err != nil {
logrus.Fatal("invalid connect address, please use host:port")

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use "net/url" instead of manual parsing: https://gobyexample.com/url-parsing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in last commit

logrus.Fatal("invalid socks5 address, please use host:port")
}
conn, err = sockDial(*serverAddr, *socksProxy, *socksUser, *socksPass)
if strings.Contains(*serverAddr, "https://") ||
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment, don't use manual parsing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in last commit

httpClient := &http.Client{Transport: httpTransport}
httpheader := &http.Header{}
httpheader.Add("User-Agent", useragent)
//Add your additional headers here
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove TODO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in last commit

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And "Blublublu" just under 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return Controller{Network: "tcp", Connection: make(chan net.Conn, 1024), ControllerConfig: config, startchan: make(chan error), SelfCertCache: "ligolo-selfcerts"}
}

type myHttpServer struct {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename struct to more compliant name, like ligoloHttpServer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in last commit

//this not so gracefully but effective ))
for {
if wsconn != nil {
logrus.Infof("Got websocket connection %s", wsconn.RemoteAddr())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a little verbose? Debugf instead of Infof?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in last commit

@nicocha30
Copy link
Owner

Hey @virusvfv

I pushed some changes in your code. Please test before I can merge.

@nicocha30 nicocha30 merged commit 97ed394 into nicocha30:master Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants