mirror of https://bitbucket.org/ausocean/av.git
input/gvctrl: using login or Login rather than logIn or LogIn
This commit is contained in:
parent
ea7bba7823
commit
0111ba706d
|
@ -81,15 +81,15 @@ func Set(host string, options ...Option) error {
|
|||
}
|
||||
|
||||
// Get the request body required for log in.
|
||||
body, err := genLogIn(client, id, host)
|
||||
body, err := getLogin(client, id, host)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not generate log in request data: %v", err)
|
||||
}
|
||||
|
||||
// Log in using generated log in request body.
|
||||
err = logIn(client, id, host, body)
|
||||
err = login(client, id, host, body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not logIn: %v", err)
|
||||
return fmt.Errorf("could not login: %v", err)
|
||||
}
|
||||
|
||||
// Apply the options to the settings specified by the user.
|
||||
|
|
|
@ -48,10 +48,10 @@ const (
|
|||
pass = "admin"
|
||||
)
|
||||
|
||||
// genLogIn gets the log in page and extracts the randomly generated cc values
|
||||
// getLogin gets the log in page and extracts the randomly generated cc values
|
||||
// from which (as well as username and password) two hashes are generated.
|
||||
// The generated hex is encoded into a url encoded form and returned as a string.
|
||||
func genLogIn(c *http.Client, id, host string) (string, error) {
|
||||
func getLogin(c *http.Client, id, host string) (string, error) {
|
||||
req, err := http.NewRequest("GET", "https://"+host+loginSubDir, nil)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("can't create GET request for log in page: %v", err)
|
||||
|
@ -100,8 +100,8 @@ func genLogIn(c *http.Client, id, host string) (string, error) {
|
|||
return f.Encode(), nil
|
||||
}
|
||||
|
||||
// logIn will submit the form b generated by genLogIn.
|
||||
func logIn(c *http.Client, id, host, b string) error {
|
||||
// login will submit the form b generated by genLogin.
|
||||
func login(c *http.Client, id, host, b string) error {
|
||||
req, err := http.NewRequest("POST", "http://"+host+loggedInSubDir, bytes.NewBuffer([]byte(b)))
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create log in request: %v", err)
|
||||
|
|
Loading…
Reference in New Issue