Preparing report...

Report for github.com/bocajim/dtls

A+    Excellent!    Found 24 issues across 43 files

Tweet

gofmt100%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command

No problems detected. Good job!


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


golint44%

Golint is a linter for Go source code.

    • dtls/debug.go
    • Line 7: warning: exported var DebugHandshake should have comment or be unexported (golint)
    • Line 8: warning: exported var DebugHandshakeHash should have comment or be unexported (golint)
    • Line 9: warning: exported var DebugEncryption should have comment or be unexported (golint)
    • Line 11: warning: exported function DebugAll should have comment or be unexported (golint)
    • dtls/handshake.go
    • Line 15: warning: don't use underscores in Go names; const handshakeType_ClientHello should be handshakeTypeClientHello (golint)
    • Line 16: warning: don't use underscores in Go names; const handshakeType_ServerHello should be handshakeTypeServerHello (golint)
    • Line 17: warning: don't use underscores in Go names; const handshakeType_HelloVerifyRequest should be handshakeTypeHelloVerifyRequest (golint)
    • Line 18: warning: don't use underscores in Go names; const handshakeType_Certificate should be handshakeTypeCertificate (golint)
    • Line 19: warning: don't use underscores in Go names; const handshakeType_ServerKeyExchange should be handshakeTypeServerKeyExchange (golint)
    • Line 20: warning: don't use underscores in Go names; const handshakeType_CertificateRequest should be handshakeTypeCertificateRequest (golint)
    • Line 21: warning: don't use underscores in Go names; const handshakeType_ServerHelloDone should be handshakeTypeServerHelloDone (golint)
    • Line 22: warning: don't use underscores in Go names; const handshakeType_CertificateVerify should be handshakeTypeCertificateVerify (golint)
    • Line 23: warning: don't use underscores in Go names; const handshakeType_ClientKeyExchange should be handshakeTypeClientKeyExchange (golint)
    • Line 24: warning: don't use underscores in Go names; const handshakeType_Finished should be handshakeTypeFinished (golint)
    • Line 27: warning: exported type CompressionMethod should have comment or be unexported (golint)
    • Line 30: warning: don't use underscores in Go names; const CompressionMethod_Null should be CompressionMethodNull (golint)
    • Line 30: warning: exported const CompressionMethod_Null should have comment (or a comment on this block) or be unexported (golint)
    • dtls/transport.go
    • Line 7: warning: exported type Transport should have comment or be unexported (golint)
    • Line 15: warning: exported type TransportEndpoint should have comment or be unexported (golint)
    • dtls/alert.go
    • Line 13: warning: don't use underscores in Go names; const AlertType_Warning should be AlertTypeWarning (golint)
    • Line 13: warning: exported const AlertType_Warning should have comment (or a comment on this block) or be unexported (golint)
    • Line 14: warning: don't use underscores in Go names; const AlertType_Fatal should be AlertTypeFatal (golint)
    • Line 15: warning: don't use underscores in Go names; const AlertDesc_CloseNotify should be AlertDescCloseNotify (golint)
    • Line 16: warning: don't use underscores in Go names; const AlertDesc_UnexpectedMessage should be AlertDescUnexpectedMessage (golint)
    • Line 17: warning: don't use underscores in Go names; const AlertDesc_BadRecordMac should be AlertDescBadRecordMac (golint)
    • Line 18: warning: don't use underscores in Go names; const AlertDesc_DecryptionFailed should be AlertDescDecryptionFailed (golint)
    • Line 19: warning: don't use underscores in Go names; const AlertDesc_RecordOverflow should be AlertDescRecordOverflow (golint)
    • Line 20: warning: don't use underscores in Go names; const AlertDesc_DecompressionFailure should be AlertDescDecompressionFailure (golint)
    • Line 21: warning: don't use underscores in Go names; const AlertDesc_HandshakeFailure should be AlertDescHandshakeFailure (golint)
    • Line 22: warning: don't use underscores in Go names; const AlertDesc_NoCertificate should be AlertDescNoCertificate (golint)
    • Line 23: warning: don't use underscores in Go names; const AlertDesc_BadCertificate should be AlertDescBadCertificate (golint)
    • Line 24: warning: don't use underscores in Go names; const AlertDesc_UnsupportedCertificate should be AlertDescUnsupportedCertificate (golint)
    • Line 25: warning: don't use underscores in Go names; const AlertDesc_CertificateRevoked should be AlertDescCertificateRevoked (golint)
    • Line 26: warning: don't use underscores in Go names; const AlertDesc_CertificateExpired should be AlertDescCertificateExpired (golint)
    • Line 27: warning: don't use underscores in Go names; const AlertDesc_CertificateUnknown should be AlertDescCertificateUnknown (golint)
    • Line 28: warning: don't use underscores in Go names; const AlertDesc_IllegalParameter should be AlertDescIllegalParameter (golint)
    • Line 29: warning: don't use underscores in Go names; const AlertDesc_UnknownCa should be AlertDescUnknownCa (golint)
    • Line 30: warning: don't use underscores in Go names; const AlertDesc_AccessDenied should be AlertDescAccessDenied (golint)
    • Line 31: warning: don't use underscores in Go names; const AlertDesc_DecodeError should be AlertDescDecodeError (golint)
    • Line 32: warning: don't use underscores in Go names; const AlertDesc_DecryptError should be AlertDescDecryptError (golint)
    • Line 33: warning: don't use underscores in Go names; const AlertDesc_ExportRestriction should be AlertDescExportRestriction (golint)
    • Line 34: warning: don't use underscores in Go names; const AlertDesc_ProtocolVersion should be AlertDescProtocolVersion (golint)
    • Line 35: warning: don't use underscores in Go names; const AlertDesc_InsufficientSecurity should be AlertDescInsufficientSecurity (golint)
    • Line 36: warning: don't use underscores in Go names; const AlertDesc_InternalError should be AlertDescInternalError (golint)
    • Line 37: warning: don't use underscores in Go names; const AlertDesc_UserCanceled should be AlertDescUserCanceled (golint)
    • Line 38: warning: don't use underscores in Go names; const AlertDesc_NoRenegotiation should be AlertDescNoRenegotiation (golint)
    • Line 39: warning: don't use underscores in Go names; const AlertDesc_UnsupportedExtension should be AlertDescUnsupportedExtension (golint)
    • Line 40: warning: don't use underscores in Go names; const AlertDesc_Noop should be AlertDescNoop (golint)
    • dtls/cert.go
    • Line 19: warning: exported function CertificateFromDisk should have comment or be unexported (golint)
    • dtls/cipher.go
    • Line 9: warning: exported type CipherSuite should have comment or be unexported (golint)
    • Line 12: warning: don't use underscores in Go names; const CipherSuite_TLS_PSK_WITH_AES_128_CCM_8 should be CipherSuiteTLSPSKWITHAES128CCM8 (golint)
    • Line 12: warning: exported const CipherSuite_TLS_PSK_WITH_AES_128_CCM_8 should have comment (or a comment on this block) or be unexported (golint)
    • Line 13: warning: don't use underscores in Go names; const CipherSuite_TLS_PSK_WITH_AES_128_CBC_SHA256 should be CipherSuiteTLSPSKWITHAES128CBCSHA256 (golint)
    • Line 14: warning: don't use underscores in Go names; const CipherSuite_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 should be CipherSuiteTLSECDHEECDSAWITHAES128CCM8 (golint)
    • Line 17: warning: exported type Cipher should have comment or be unexported (golint)
    • dtls/log.go
    • Line 14: warning: exported const LogLevelError should have comment (or a comment on this block) or be unexported (golint)
    • Line 20: warning: exported type LogFunc should have comment or be unexported (golint)
    • Line 25: warning: exported function SetLogFunc should have comment or be unexported (golint)
    • Line 29: warning: exported function SetLogLevel should have comment or be unexported (golint)
    • dtls/record.go
    • Line 13: warning: exported type ContentType should have comment or be unexported (golint)
    • Line 16: warning: don't use underscores in Go names; const ContentType_ChangeCipherSpec should be ContentTypeChangeCipherSpec (golint)
    • Line 16: warning: exported const ContentType_ChangeCipherSpec should have comment (or a comment on this block) or be unexported (golint)
    • Line 17: warning: don't use underscores in Go names; const ContentType_Alert should be ContentTypeAlert (golint)
    • Line 18: warning: don't use underscores in Go names; const ContentType_Handshake should be ContentTypeHandshake (golint)
    • Line 19: warning: don't use underscores in Go names; const ContentType_Appdata should be ContentTypeAppdata (golint)
    • dtls/transport_udp.go
    • Line 77: warning: receiver name p should be consistent with previous receiver name u for udpTransport (golint)
    • Line 84: warning: exported function NewUdpPeerFromSocket should have comment or be unexported (golint)
    • dtls/cipher_cbc.go
    • Line 21: warning: exported type CipherCBC should have comment or be unexported (golint)
    • Line 25: warning: exported method CipherCBC.GetPrfSize should have comment or be unexported (golint)
    • Line 29: warning: exported method CipherCBC.GenerateKeyBlock should have comment or be unexported (golint)
    • Line 54: warning: exported method CipherCBC.Encrypt should have comment or be unexported (golint)
    • Line 102: warning: exported method CipherCBC.Decrypt should have comment or be unexported (golint)
    • dtls/cipher_ccm.go
    • Line 5: warning: package comment should be of the form "Package dtls ..." (golint)
    • Line 21: warning: exported type CipherCcm should have comment or be unexported (golint)
    • Line 25: warning: exported method CipherCcm.GetPrfSize should have comment or be unexported (golint)
    • Line 29: warning: exported method CipherCcm.GenerateKeyBlock should have comment or be unexported (golint)
    • Line 33: warning: exported method CipherCcm.Encrypt should have comment or be unexported (golint)
    • Line 72: warning: exported method CipherCcm.Decrypt should have comment or be unexported (golint)
    • Line 306: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • dtls/dtls.go
    • Line 16: warning: exported type Listener should have comment or be unexported (golint)
    • Line 30: warning: exported var SessionInactivityTimeout should have comment or be unexported (golint)
    • Line 37: warning: comment on exported var HandshakeCompleteCallback should be of the form "HandshakeCompleteCallback ..." (golint)
    • Line 39: warning: exported var SessionImportCallback should have comment or be unexported (golint)
    • Line 40: warning: exported var SessionExportCallback should have comment or be unexported (golint)
    • Line 41: warning: exported var ValidateCertificateCallback should have comment or be unexported (golint)
    • Line 43: warning: exported function NewUdpListener should have comment or be unexported (golint)
    • Line 157: warning: exported method Listener.SetCertificate should have comment or be unexported (golint)
    • Line 165: warning: exported method Listener.SetFrameLimits should have comment or be unexported (golint)
    • Line 170: warning: exported method Listener.RemovePeer should have comment or be unexported (golint)
    • Line 180: warning: exported method Listener.RemovePeerByAddr should have comment or be unexported (golint)
    • Line 212: warning: exported type PeerParams should have comment or be unexported (golint)
    • Line 219: warning: exported method Listener.AddPeer should have comment or be unexported (golint)
    • Line 223: warning: exported method Listener.AddPeerWithParams should have comment or be unexported (golint)
    • Line 259: warning: exported method Listener.Shutdown should have comment or be unexported (golint)
    • Line 267: warning: exported method Listener.AddCipherSuite should have comment or be unexported (golint)
    • Line 275: warning: exported method Listener.AddCompressionMethod should have comment or be unexported (golint)
    • Line 283: warning: exported method Listener.FindPeer should have comment or be unexported (golint)
    • Line 289: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 294: warning: exported method Listener.CountPeers should have comment or be unexported (golint)
    • Line 302: warning: exported method Listener.EachPeer should have comment or be unexported (golint)
    • dtls/keystore.go
    • Line 9: warning: exported type Keystore should have comment or be unexported (golint)
    • Line 15: warning: exported function SetKeyStores should have comment or be unexported (golint)
    • Line 19: warning: exported function GetPskFromKeystore should have comment or be unexported (golint)
    • Line 30: warning: exported type KeystoreInMemory should have comment or be unexported (golint)
    • Line 34: warning: exported function NewKeystoreInMemory should have comment or be unexported (golint)
    • Line 38: warning: exported method KeystoreInMemory.AddKey should have comment or be unexported (golint)
    • Line 43: warning: exported method KeystoreInMemory.GetPsk should have comment or be unexported (golint)
    • dtls/peer.go
    • Line 16: warning: exported type Peer should have comment or be unexported (golint)
    • Line 25: warning: exported method Peer.SetName should have comment or be unexported (golint)
    • Line 29: warning: exported method Peer.UseQueue should have comment or be unexported (golint)
    • Line 41: warning: exported method Peer.RemoteAddr should have comment or be unexported (golint)
    • Line 48: warning: exported method Peer.SessionIdentity should have comment or be unexported (golint)
    • Line 52: warning: exported method Peer.SessionIdentityString should have comment or be unexported (golint)
    • Line 55: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 60: warning: exported method Peer.SessionPublicKey should have comment or be unexported (golint)
    • Line 67: warning: exported method Peer.SessionCertificate should have comment or be unexported (golint)
    • Line 74: warning: exported method Peer.LastActivity should have comment or be unexported (golint)
    • Line 78: warning: exported method Peer.Close should have comment or be unexported (golint)
    • Line 103: warning: exported method Peer.SessionExport should have comment or be unexported (golint)
    • Line 106: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 111: warning: exported method Peer.Lock should have comment or be unexported (golint)
    • Line 115: warning: exported method Peer.Unlock should have comment or be unexported (golint)
    • dtls/session.go
    • Line 15: warning: don't use underscores in Go names; const SessionType_Server should be SessionTypeServer (golint)
    • Line 15: warning: exported const SessionType_Server should have comment (or a comment on this block) or be unexported (golint)
    • Line 16: warning: don't use underscores in Go names; const SessionType_Client should be SessionTypeClient (golint)
    • Line 178: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • dtls/session_export.go
    • Line 14: warning: exported function SetExportSecret should have comment or be unexported (golint)
    • Line 20: warning: exported type SessionStore should have comment or be unexported (golint)
    • dtls/crypto.go
    • Line 17: warning: exported const AadAuthLen should have comment (or a comment on this block) or be unexported (golint)
    • Line 44: warning: exported type KeyBlock should have comment or be unexported (golint)
    • Line 54: warning: exported method KeyBlock.Print should have comment or be unexported (golint)
    • dtls/ecc_curves.go
    • Line 24: warning: don't use underscores in Go names; const EccCurve_P256 should be EccCurveP256 (golint)
    • Line 24: warning: exported const EccCurve_P256 should have comment (or a comment on this block) or be unexported (golint)
    • dtls/session_handshake.go
    • Line 38: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 67: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 145: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 206: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 215: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 255: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 619: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • dtls/common.go
    • Line 12: warning: exported const DtlsVersion12 should have comment (or a comment on this block) or be unexported (golint)
    • dtls/session_cache.go
    • Line 23: warning: comment on exported var SessionCacheTtl should be of the form "SessionCacheTtl ..." (golint)
    • Line 26: warning: comment on exported var SessionCacheSweepInterval should be of the form "SessionCacheSweepInterval ..." (golint)
    • Line 29: warning: exported function SessionCacheSize should have comment or be unexported (golint)

gocyclo93%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

    • dtls/session_handshake.go
    • Line 264: warning: cyclomatic complexity 82 of function (*session).processHandshakePacket() is high (> 15) (gocyclo)
    • Line 17: warning: cyclomatic complexity 16 of function (*session).parseRecord() is high (> 15) (gocyclo)
    • dtls/alert.go
    • Line 80: warning: cyclomatic complexity 26 of function alertDescToString() is high (> 15) (gocyclo)
    • dtls/dtls.go
    • Line 56: warning: cyclomatic complexity 16 of function receiver() is high (> 15) (gocyclo)

ineffassign97%

IneffAssign detects ineffectual assignments in Go code.


license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


misspell97%

Misspell Finds commonly misspelled English words