-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_test.go
More file actions
52 lines (43 loc) · 808 Bytes
/
example_test.go
File metadata and controls
52 lines (43 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package turtle
import (
"context"
"net/http"
"net/url"
"time"
)
func ExampleSlowloris() {
u, err := url.Parse("http://127.0.0.1:8080")
if err != nil {
panic(err)
}
s := Slowloris{
Target: Target{
Url: *u,
},
SendGibberish: true,
GibberishInterval: 5 * time.Millisecond,
UserAgents: []string{
"turtle/0.0.1",
"turtle/0.0.1 - slowloris",
},
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_ = s.Run(ctx)
}
func ExampleSlowBodyReadRequest() {
u, err := url.Parse("http://127.0.0.1:8080")
if err != nil {
panic(err)
}
s := SlowBodyReadRequest{
Target: Target{
Url: *u,
},
Method: http.MethodPost,
BodyReadTimeout: 180 * time.Second,
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_ = s.Run(ctx)
}