Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use specic port with this #66

Closed
kateile opened this issue Jan 20, 2023 · 5 comments
Closed

How to use specic port with this #66

kateile opened this issue Jan 20, 2023 · 5 comments

Comments

@kateile
Copy link

kateile commented Jan 20, 2023

I was using ngrok http 7373 from bash now I want to switch to this but I can't figure how.

This is how I use it

tun, err := ngrok.Listen(context.Background(),
			config.HTTPEndpoint(),
			ngrok.WithAuthtokenFromEnv(),
		)
		if err != nil {
			log.Printf("ngrok error: %s", err.Error())
			return
		}

		log.Println("tunnel created:", baseUrl)
@russorat
Copy link
Contributor

russorat commented Jan 20, 2023

Hi @kateile, thanks for the issue!

This library is intended to be embedded directly into the go application you are running on port 7373, such that the requests are sent directly to your handler function.

Can you explain a little more about the use case you are trying to solve here so we can figure out the right solution?

@kateile
Copy link
Author

kateile commented Jan 21, 2023

@russorat thanks for response.

Running ngrok via bash seems to work fine. But with this lib I get ERR_NGROK_3004. That's why I thought may be I might be missing something on port configuration.

I will try to reproduce on it another repository.

@jrobsonchase
Copy link
Collaborator

Hey @kateile!

We're working on adding built-in connection forwarding to the library to support this kind of usecase out of the box. You can find the draft of it here: #74.

If this is still something you're trying to do, we'd love some feedback!

@NotSoSeriouss
Copy link

Can you provide a minimal explanation on how to achieve this while the new version is getting released?

@jrobsonchase
Copy link
Collaborator

This was actually released a few months ago! You want either the top-level ListenAndForward function, or the ListenAndForward method on the Session interface. A minimal example can be found here.

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

No branches or pull requests

4 participants