Rename pkg/misc to pkg/hashutil

It only had one function anyway.

Change-Id: Iec4b7868d823148c8e1d2607347fe9d3c1463403
This commit is contained in:
Brad Fitzpatrick 2014-11-06 13:31:58 -03:00
parent 59b6cad0bf
commit 0e841e0f51
3 changed files with 7 additions and 9 deletions

View File

@ -39,8 +39,8 @@ import (
"camlistore.org/pkg/blob"
"camlistore.org/pkg/blobserver"
"camlistore.org/pkg/client/android"
"camlistore.org/pkg/hashutil"
"camlistore.org/pkg/httputil"
"camlistore.org/pkg/misc"
"camlistore.org/pkg/osutil"
"camlistore.org/pkg/schema"
"camlistore.org/pkg/search"
@ -930,7 +930,7 @@ func (c *Client) DialFunc() func(network, addr string) (net.Conn, error) {
if certs == nil || len(certs) < 1 {
return nil, errors.New("Could not get server's certificate from the TLS connection.")
}
sig := misc.SHA256Prefix(certs[0].Raw)
sig := hashutil.SHA256Prefix(certs[0].Raw)
for _, v := range trustedCerts {
if v == sig {
return conn, nil

View File

@ -14,10 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package misc contains stuff which should probably move elsewhere.
//
// This is a gross place to put code.
package misc
// Package hashutil contains misc hashing functions lacking homes elsewhere.
package hashutil
import (
"crypto/sha256"

View File

@ -41,9 +41,9 @@ import (
"time"
"camlistore.org/pkg/buildinfo"
"camlistore.org/pkg/hashutil"
"camlistore.org/pkg/httputil"
"camlistore.org/pkg/legal/legalprint"
"camlistore.org/pkg/misc"
"camlistore.org/pkg/netutil"
"camlistore.org/pkg/osutil"
"camlistore.org/pkg/serverinit"
@ -184,7 +184,7 @@ func genSelfTLS(listen string) error {
if err != nil {
return fmt.Errorf("Failed to parse certificate: %v", err)
}
sig := misc.SHA256Prefix(cert.Raw)
sig := hashutil.SHA256Prefix(cert.Raw)
hint := "You must add this certificate's fingerprint to your client's trusted certs list to use it. Like so:\n" +
`"trustedCerts": ["` + sig + `"],`
log.Printf(hint)
@ -303,7 +303,7 @@ func setupTLS(ws *webserver.Server, config *serverinit.Config, listen string) {
if err != nil {
exitf("Failed to parse certificate: %v", err)
}
sig := misc.SHA256Prefix(certif.Raw)
sig := hashutil.SHA256Prefix(certif.Raw)
log.Printf("TLS enabled, with SHA-256 certificate fingerprint: %v", sig)
ws.SetTLS(cert, key)
}