mirror of
https://github.com/fumiama/go-nd-portal.git
synced 2026-07-02 00:50:25 +08:00
support dx login
This commit is contained in:
@@ -44,8 +44,8 @@ func NewPortal(name, password string, ipv4 net.IP) (*Portal, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (p *Portal) GetChallenge() (string, error) {
|
||||
u := fmt.Sprintf(PortalGetChallenge, "gondportal", url.QueryEscape(p.nam), p.ip, time.Now().UnixMilli())
|
||||
func (p *Portal) GetChallenge(u string) (string, error) {
|
||||
u = fmt.Sprintf(u, "gondportal", url.QueryEscape(p.nam), p.ip, time.Now().UnixMilli())
|
||||
logrus.Debugln("GET", u)
|
||||
data, err := requestDataWith(u, "GET", PortalHeaderUA)
|
||||
if err != nil {
|
||||
@@ -74,10 +74,10 @@ func (p *Portal) PasswordHMd5(challenge string) string {
|
||||
return hex.EncodeToString(h.Sum(buf[:0]))
|
||||
}
|
||||
|
||||
func (p *Portal) Login(challenge string) error {
|
||||
func (p *Portal) Login(u, domain, challenge string) error {
|
||||
info := EncodeUserInfo(p.String(), challenge)
|
||||
hmd5 := p.PasswordHMd5(challenge)
|
||||
u := fmt.Sprintf(PortalLogin, "gondportal", url.QueryEscape(p.nam), hmd5, p.ip, p.CheckSum(challenge, hmd5, info), url.QueryEscape(info), time.Now().UnixMilli())
|
||||
u = fmt.Sprintf(u, "gondportal", url.QueryEscape(p.nam), hmd5, p.ip, p.CheckSum(domain, challenge, hmd5, info), url.QueryEscape(info), time.Now().UnixMilli())
|
||||
logrus.Debugln("GET", u)
|
||||
data, err := requestDataWith(u, "GET", PortalHeaderUA)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user