gofmt
This commit is contained in:
		
							parent
							
								
									64ca86effa
								
							
						
					
					
						commit
						d1605ee841
					
				
							
								
								
									
										2
									
								
								main.go
								
								
								
								
							
							
						
						
									
										2
									
								
								main.go
								
								
								
								
							|  | @ -1,8 +1,8 @@ | |||
| package main | ||||
| 
 | ||||
| import ( | ||||
| 	"flag" | ||||
| 	"encoding/base64" | ||||
| 	"flag" | ||||
| 
 | ||||
| 	"dev.sum7.eu/genofire/golang-lib/file" | ||||
| 	"github.com/bdlm/log" | ||||
|  |  | |||
|  | @ -2,16 +2,16 @@ package main | |||
| 
 | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"fmt" | ||||
| 	"net/http" | ||||
| 	"time" | ||||
| 	"fmt" | ||||
| ) | ||||
| 
 | ||||
| func (c *configData) Request(url string, value interface{}) error { | ||||
| 	netClient := &http.Client{ | ||||
| 		Timeout: time.Second * 20, | ||||
| 	} | ||||
| 	req, err := http.NewRequest(http.MethodGet, c.Host + url, nil) | ||||
| 	req, err := http.NewRequest(http.MethodGet, c.Host+url, nil) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | @ -30,4 +30,3 @@ func (c *configData) Request(url string, value interface{}) error { | |||
| 	} | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,7 +8,6 @@ const ( | |||
| 	URLRequestListVHost  = "/v1/vhosts" | ||||
| 	URLRequestListApp    = "/v1/vhosts/%s/apps" | ||||
| 	URLRequestListStream = "/v1/vhosts/%s/apps/%s/streams" | ||||
| 
 | ||||
| ) | ||||
| 
 | ||||
| type ResponseList struct { | ||||
|  | @ -20,7 +19,7 @@ type ResponseList struct { | |||
| func (c *configData) RequestListVHosts() (*ResponseList, error) { | ||||
| 	req := ResponseList{} | ||||
| 	url := fmt.Sprintf(URLRequestListVHost) | ||||
| 	if err := c.Request(url, &req); err != nil{ | ||||
| 	if err := c.Request(url, &req); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return &req, nil | ||||
|  | @ -29,7 +28,7 @@ func (c *configData) RequestListVHosts() (*ResponseList, error) { | |||
| func (c *configData) RequestListApps(vhost string) (*ResponseList, error) { | ||||
| 	req := ResponseList{} | ||||
| 	url := fmt.Sprintf(URLRequestListApp, vhost) | ||||
| 	if err := c.Request(url, &req); err != nil{ | ||||
| 	if err := c.Request(url, &req); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return &req, nil | ||||
|  | @ -38,7 +37,7 @@ func (c *configData) RequestListApps(vhost string) (*ResponseList, error) { | |||
| func (c *configData) RequestListStreams(vhost, app string) (*ResponseList, error) { | ||||
| 	req := ResponseList{} | ||||
| 	url := fmt.Sprintf(URLRequestListStream, vhost, app) | ||||
| 	if err := c.Request(url, &req); err != nil{ | ||||
| 	if err := c.Request(url, &req); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return &req, nil | ||||
|  |  | |||
|  | @ -10,7 +10,6 @@ const ( | |||
| 	URLRequestStatsVHost  = "/v1/stats/current/vhosts/%s" | ||||
| 	URLRequestStatsApp    = "/v1/stats/current/vhosts/%s/apps/%s" | ||||
| 	URLRequestStatsStream = "/v1/stats/current/vhosts/%s/apps/%s/streams/%s" | ||||
| 
 | ||||
| ) | ||||
| 
 | ||||
| type ResponseStats struct { | ||||
|  | @ -34,7 +33,6 @@ type ResponseStatsData struct { | |||
| 	TotalBytesOut uint64 `json:"totalBytesOut" example:"117022184"` | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| func (resp *ResponseStats) Log(log *log.Entry) { | ||||
| 	logger := log | ||||
| 	if resp.Data != nil { | ||||
|  | @ -48,7 +46,7 @@ func (resp *ResponseStats) Log(log *log.Entry) { | |||
| func (c *configData) RequestStatsVHost(vhost string) (*ResponseStats, error) { | ||||
| 	req := ResponseStats{} | ||||
| 	url := fmt.Sprintf(URLRequestStatsVHost, vhost) | ||||
| 	if err := c.Request(url, &req); err != nil{ | ||||
| 	if err := c.Request(url, &req); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return &req, nil | ||||
|  | @ -57,7 +55,7 @@ func (c *configData) RequestStatsVHost(vhost string) (*ResponseStats, error) { | |||
| func (c *configData) RequestStatsApp(vhost, app string) (*ResponseStats, error) { | ||||
| 	req := ResponseStats{} | ||||
| 	url := fmt.Sprintf(URLRequestStatsApp, vhost, app) | ||||
| 	if err := c.Request(url, &req); err != nil{ | ||||
| 	if err := c.Request(url, &req); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return &req, nil | ||||
|  | @ -66,7 +64,7 @@ func (c *configData) RequestStatsApp(vhost, app string) (*ResponseStats, error) | |||
| func (c *configData) RequestStatsStream(vhost, app, stream string) (*ResponseStats, error) { | ||||
| 	req := ResponseStats{} | ||||
| 	url := fmt.Sprintf(URLRequestStatsStream, vhost, app, stream) | ||||
| 	if err := c.Request(url, &req); err != nil{ | ||||
| 	if err := c.Request(url, &req); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return &req, nil | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue