socks5-server/credentials.go

21 lines
346 B
Go
Raw Normal View History

2024-01-12 14:27:55 +03:00
package main
import (
"encoding/json"
)
2024-01-13 09:22:40 +03:00
type Credentials struct {
Username string `json:"username"`
Password string `json:"password"`
2024-01-12 14:27:55 +03:00
}
2024-01-13 09:22:40 +03:00
func parseCredentials(credsString string) ([]Credentials, error) {
var creds []Credentials
2024-01-12 14:27:55 +03:00
err := json.Unmarshal([]byte(credsString), &creds)
if err != nil {
return nil, err
}
2024-01-13 09:22:40 +03:00
return creds, nil
2024-01-12 14:27:55 +03:00
}