This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func main() { | |
| bridge := make(chan int) //creating the channel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func TestBrowseMiddlewareForHtmlResponse(t *testing.T) { | |
| //formulating configuration for starting Caddy. | |
| //The configuration below is used defualt host <localhost> and default port <2015> for running the server | |
| //browse middleware is activated | |
| input := caddy.CaddyfileInput{ | |
| Contents: []byte(fmt.Sprintf("%s:%s\nbasicauth /protected my-username my-passworde ", caddy.DefaultHost, "2015")), | |
| } | |
| //starting caddy server | |
| err := caddy.Start(input) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package integration_tests | |
| import ( | |
| "encoding/base64" | |
| "fmt" | |
| "github.com/mholt/caddy/caddy" | |
| "net/http" | |
| "testing" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "io/ioutil" | |
| ) | |
| func main() { | |
| httpObjectUsedToSendHttpRequest := &http.Client{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "net" | |
| ) | |
| func main() { | |
| _, err := net.Dial("tcp", "192.168.0.240:8080") | |
| panic(err.Error()) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net" | |
| "syscall" | |
| ) | |
| func main() { | |
| _, err := net.Dial("tcp", "192.168.0.110:8080") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| array := [4]int{1,2,3,4} | |
| sliceFromArray := array[:3] | |
| fmt.Printf("array = %v , slice = %v\n",array,sliceFromArray) | |
| sliceFromArray[2] = 4 | |
| fmt.Printf("array = %v , slice = %v\n",array,sliceFromArray) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| array := [4]int{1,2,3,4} | |
| sliceFromArray := array[:3] | |
| fmt.Printf("array = %v , slice = %v\n",array,sliceFromArray) | |
| sliceFromArray[2] = 4 | |
| fmt.Printf("array = %v , slice = %v\n",array,sliceFromArray) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| array := [4]int{1,2,3,4} | |
| sliceFromArray := array[:3] | |
| fmt.Printf("array = %v , slice = %v\n",array,sliceFromArray) | |
| sliceFromArray[2] = 4 | |
| fmt.Printf("array = %v , slice = %v\n",array,sliceFromArray) |