MCPcopy Create free account
hub / github.com/Moopinger/smugglefuzz / NewTarget

Function NewTarget

lib/target.go:34–63  ·  view source on GitHub ↗
(url string)

Source from the content-addressed store, hash-verified

32}
33
34func NewTarget(url string) (*Target, error) {
35
36 if url == "" {
37 return nil, fmt.Errorf("URL cannot be empty")
38 }
39
40 if strings.ToLower(url[:4]) != "http" {
41 url = "https://" + url
42 }
43 u, err := neturl.Parse(url)
44
45 if u.Scheme != "https" {
46 return nil, fmt.Errorf("H2C not implemented. If needed see the \"experimental-h2c\" branch")
47 }
48
49 if u.Port() == "" {
50 u.Host = u.Host + ":443"
51 }
52
53 if u.Path == "" {
54 u.Path = "/"
55 }
56
57 if err != nil {
58 return nil, err
59 }
60 return &Target{
61 URL: *u,
62 }, nil
63}
64
65func (t *Target) GetConnection() (*tls.Conn, error) {
66 var conn *tls.Conn

Callers 2

scan.goFile · 0.92
request.goFile · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected