mirror of
https://github.com/kataras/iris.git
synced 2025-12-23 12:57:05 +00:00
New feature: automatic public domain using tunneling: https://github.com/kataras/iris/issues/1305
Former-commit-id: 54844edae9e5eed9bd6b17a06ec8d868923d3681
This commit is contained in:
@@ -78,6 +78,7 @@ Structuring depends on your own needs. We can't tell you how to design your own
|
||||
### HTTP Listening
|
||||
|
||||
- [Common, with address](http-listening/listen-addr/main.go)
|
||||
* [public domain address](http-listening/listen-addr-public/main.go) **NEW**
|
||||
* [omit server errors](http-listening/listen-addr/omit-server-errors/main.go)
|
||||
- [UNIX socket file](http-listening/listen-unix/main.go)
|
||||
- [TLS](http-listening/listen-tls/main.go)
|
||||
|
||||
1
_examples/http-listening/listen-addr-public/README.md
Normal file
1
_examples/http-listening/listen-addr-public/README.md
Normal file
@@ -0,0 +1 @@
|
||||

|
||||
36
_examples/http-listening/listen-addr-public/main.go
Normal file
36
_examples/http-listening/listen-addr-public/main.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.HTML("<h1>Hello World!</h1>")
|
||||
|
||||
// Will print the ngrok public domain
|
||||
// that your app is using to be served online.
|
||||
ctx.Writef("From: %s",
|
||||
ctx.Application().ConfigurationReadOnly().GetVHost())
|
||||
})
|
||||
|
||||
app.Run(iris.Addr(":8080"), iris.WithTunneling)
|
||||
|
||||
/* The full configuration can be set as:
|
||||
app.Run(iris.Addr(":8080"), iris.WithConfiguration(
|
||||
iris.Configuration{
|
||||
Tunneling: iris.TunnelingConfiguration{
|
||||
AuthToken: "my-ngrok-auth-client-token",
|
||||
Bin: "/bin/path/for/ngrok",
|
||||
Region: "eu",
|
||||
WebInterface: "127.0.0.1:4040",
|
||||
Tunnels: []iris.Tunnel{
|
||||
{
|
||||
Name: "MyApp",
|
||||
Addr: ":8080",
|
||||
},
|
||||
},
|
||||
},
|
||||
}))
|
||||
*/
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 164 KiB |
Reference in New Issue
Block a user