forked from jshiffer/go-xmpp
Readability improvements. (#175)
* Improve readability of switch statement for auth mechanism choice We have enough space in the width here, so it is not necessary to span the cases over two lines.
This commit is contained in:
parent
c1b9689e75
commit
e7d5b17113
27
xmpp.go
27
xmpp.go
@ -412,32 +412,23 @@ func (c *Client) init(o *Options) error {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch {
|
switch {
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "SCRAM-SHA-512-PLUS") && tlsConnOK:
|
||||||
"SCRAM-SHA-512-PLUS") && tlsConnOK:
|
|
||||||
mechanism = "SCRAM-SHA-512-PLUS"
|
mechanism = "SCRAM-SHA-512-PLUS"
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "SCRAM-SHA-256-PLUS") && tlsConnOK:
|
||||||
"SCRAM-SHA-256-PLUS") && tlsConnOK:
|
|
||||||
mechanism = "SCRAM-SHA-256-PLUS"
|
mechanism = "SCRAM-SHA-256-PLUS"
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "SCRAM-SHA-1-PLUS") && tlsConnOK:
|
||||||
"SCRAM-SHA-1-PLUS") && tlsConnOK:
|
|
||||||
mechanism = "SCRAM-SHA-1-PLUS"
|
mechanism = "SCRAM-SHA-1-PLUS"
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "SCRAM-SHA-512"):
|
||||||
"SCRAM-SHA-512"):
|
|
||||||
mechanism = "SCRAM-SHA-512"
|
mechanism = "SCRAM-SHA-512"
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "SCRAM-SHA-256"):
|
||||||
"SCRAM-SHA-256"):
|
|
||||||
mechanism = "SCRAM-SHA-256"
|
mechanism = "SCRAM-SHA-256"
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "SCRAM-SHA-1"):
|
||||||
"SCRAM-SHA-1"):
|
|
||||||
mechanism = "SCRAM-SHA-1"
|
mechanism = "SCRAM-SHA-1"
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "X-OAUTH2"):
|
||||||
"X-OAUTH2"):
|
|
||||||
mechanism = "X-OAUTH2"
|
mechanism = "X-OAUTH2"
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "PLAIN") && tlsConnOK:
|
||||||
"PLAIN") && tlsConnOK:
|
|
||||||
mechanism = "PLAIN"
|
mechanism = "PLAIN"
|
||||||
case slices.Contains(f.Mechanisms.Mechanism,
|
case slices.Contains(f.Mechanisms.Mechanism, "DIGEST-MD5"):
|
||||||
"DIGEST-MD5"):
|
|
||||||
mechanism = "DIGEST-MD5"
|
mechanism = "DIGEST-MD5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user