github.com/glimps-jbo/go-licenses@v0.0.0-20230908151000-e06d3c113277/licenses/types.go (about) 1 package licenses 2 3 // Type identifies a class of software license. 4 type Type string 5 6 // License types 7 const ( 8 // Unknown license type. 9 Unknown = Type("") 10 // Restricted licenses require mandatory source distribution if we ship a 11 // product that includes third-party code protected by such a license. 12 Restricted = Type("restricted") 13 // Reciprocal licenses allow usage of software made available under such 14 // licenses freely in *unmodified* form. If the third-party source code is 15 // modified in any way these modifications to the original third-party 16 // source code must be made available. 17 Reciprocal = Type("reciprocal") 18 // Notice licenses contain few restrictions, allowing original or modified 19 // third-party software to be shipped in any product without endangering or 20 // encumbering our source code. All of the licenses in this category do, 21 // however, have an "original Copyright notice" or "advertising clause", 22 // wherein any external distributions must include the notice or clause 23 // specified in the license. 24 Notice = Type("notice") 25 // Permissive licenses are even more lenient than a 'notice' license. 26 // Not even a copyright notice is required for license compliance. 27 Permissive = Type("permissive") 28 // Unencumbered covers licenses that basically declare that the code is "free for any use". 29 Unencumbered = Type("unencumbered") 30 31 ByExceptionOnly = Type("byExceptionOnly") 32 // Forbidden licenses are forbidden to be used. 33 Forbidden = Type("forbidden") 34 ) 35 36 func (t Type) String() string { 37 switch t { 38 case Unknown: 39 // licenseclassifier uses an empty string to indicate an unknown license 40 // type, which is unclear to users when printed as a string. 41 return "unknown" 42 default: 43 return string(t) 44 } 45 } 46 47 var typeMap = map[string]Type{ 48 "BCL": Restricted, 49 "CC-BY-ND-1.0": Restricted, 50 "CC-BY-ND-2.0": Restricted, 51 "CC-BY-ND-2.5": Restricted, 52 "CC-BY-ND-3.0": Restricted, 53 "CC-BY-ND-4.0": Restricted, 54 "CC-BY-SA-1.0": Restricted, 55 "CC-BY-SA-2.0": Restricted, 56 "CC-BY-SA-2.5": Restricted, 57 "CC-BY-SA-3.0": Restricted, 58 "CC-BY-SA-4.0": Restricted, 59 "GPL-1.0": Restricted, 60 "GPL-2.0": Restricted, 61 "GPL-2.0-with-GCC-exception": Restricted, 62 "GPL-2.0-with-autoconf-exception": Restricted, 63 "GPL-2.0-with-bison-exception": Restricted, 64 "GPL-2.0-with-classpath-exception": Restricted, 65 "GPL-2.0-with-font-exception": Restricted, 66 "GPL-3.0": Restricted, 67 "GPL-3.0-with-GCC-exception": Restricted, 68 "GPL-3.0-with-autoconf-exception": Restricted, 69 "GPL-3.0-with-bison-exception": Restricted, 70 "LGPL-2.0": Restricted, 71 "LGPL-2.1": Restricted, 72 "LGPL-3.0": Restricted, 73 "NPL-1.0": Restricted, 74 "NPL-1.1": Restricted, 75 "OSL-1.0": Restricted, 76 "OSL-1.1": Restricted, 77 "OSL-2.0": Restricted, 78 "OSL-2.1": Restricted, 79 "OSL-3.0": Restricted, 80 "QPL-1.0": Restricted, 81 "Sleepycat": Restricted, 82 83 "APSL-1.0": Reciprocal, 84 "APSL-1.1": Reciprocal, 85 "APSL-1.2": Reciprocal, 86 "APSL-2.0": Reciprocal, 87 "CDDL-1.0": Reciprocal, 88 "CDDL-1.1": Reciprocal, 89 "CPL-1.0": Reciprocal, 90 "EPL-1.0": Reciprocal, 91 "EPL-2.0": Reciprocal, 92 "FreeImage": Reciprocal, 93 "IPL-1.0": Reciprocal, 94 "MPL-1.0": Reciprocal, 95 "MPL-1.1": Reciprocal, 96 "MPL-2.0": Reciprocal, 97 "Ruby": Reciprocal, 98 99 "AFL-1.1": Notice, 100 "AFL-1.2": Notice, 101 "AFL-2.0": Notice, 102 "AFL-2.1": Notice, 103 "AFL-3.0": Notice, 104 "Apache-1.0": Notice, 105 "Apache-1.1": Notice, 106 "Apache-2.0": Notice, 107 "Apache-2.0-Modified": Notice, 108 "Apache-with-LLVM-Exception": Notice, 109 "Apache-with-Runtime-Exception": Notice, 110 "Artistic-1.0": Notice, 111 "Artistic-1.0-Perl": Notice, 112 "Artistic-1.0-cl8": Notice, 113 "Artistic-2.0": Notice, 114 "BSD-2-Clause": Notice, 115 "BSD-2-Clause-FreeBSD": Notice, 116 "BSD-2-Clause-NetBSD": Notice, 117 "BSD-2-Clause-Flex": Notice, 118 "BSD-2-Clause-Patent": Notice, 119 "BSD-3-Clause": Notice, 120 "BSD-3-Clause-Attribution": Notice, 121 "BSD-3-Clause-Clear": Notice, 122 "BSD-3-Clause-LBNL": Notice, 123 "BSD-3-Clause-OpenMPI": Notice, 124 "BSD-4-Clause": Notice, 125 "BSD-4-Clause-UC": Notice, 126 "BSD-Protection": Notice, 127 "BSL-1.0": Notice, 128 "CC-BY-1.0": Notice, 129 "CC-BY-2.0": Notice, 130 "CC-BY-2.5": Notice, 131 "CC-BY-3.0": Notice, 132 "CC-BY-4.0": Notice, 133 "FTL": Notice, 134 "ISC": Notice, 135 "ImageMagick": Notice, 136 "LPL-1.0": Notice, 137 "LPL-1.02": Notice, 138 "Libpng": Notice, 139 "Lil-1.0": Notice, 140 "Linux-OpenIB": Notice, 141 "MIT": Notice, 142 "MS-PL": Notice, 143 "NCSA": Notice, 144 "OpenSSL": Notice, 145 "PHP-3.0": Notice, 146 "PHP-3.01": Notice, 147 "PIL": Notice, 148 "PostgreSQL": Notice, 149 "Python-2.0": Notice, 150 "Python-2.0-complete": Notice, 151 "SGI-B-1.0": Notice, 152 "SGI-B-1.1": Notice, 153 "SGI-B-2.0": Notice, 154 "UPL-1.0": Notice, 155 "Unicode-DFS-2015": Notice, 156 "Unicode-DFS-2016": Notice, 157 "Unicode-TOU": Notice, 158 "W3C": Notice, 159 "W3C-19980720": Notice, 160 "W3C-20150513": Notice, 161 "X11": Notice, 162 "Xnet": Notice, 163 "ZPL-1.1": Notice, 164 "ZPL-2.0": Notice, 165 "ZPL-2.1": Notice, 166 "Zend-2.0": Notice, 167 "Zlib": Notice, 168 "zlib-acknowledgement": Notice, 169 170 "BSD-0-Clause": Unencumbered, 171 "CC0-1.0": Unencumbered, 172 "Unlicense": Unencumbered, 173 174 "AGPL-1.0": Forbidden, 175 "AGPL-3.0": Forbidden, 176 "CC-BY-NC-1.0": Forbidden, 177 "CC-BY-NC-2.0": Forbidden, 178 "CC-BY-NC-2.5": Forbidden, 179 "CC-BY-NC-3.0": Forbidden, 180 "CC-BY-NC-4.0": Forbidden, 181 "CC-BY-NC-ND-1.0": Forbidden, 182 "CC-BY-NC-ND-2.0": Forbidden, 183 "CC-BY-NC-ND-2.5": Forbidden, 184 "CC-BY-NC-ND-3.0": Forbidden, 185 "CC-BY-NC-ND-4.0": Forbidden, 186 "CC-BY-NC-SA-1.0": Forbidden, 187 "CC-BY-NC-SA-2.0": Forbidden, 188 "CC-BY-NC-SA-2.5": Forbidden, 189 "CC-BY-NC-SA-3.0": Forbidden, 190 "CC-BY-NC-SA-4.0": Forbidden, 191 "Commons-Clause": Forbidden, 192 "Facebook-2-Clause": Forbidden, 193 "Facebook-3-Clause": Forbidden, 194 "Facebook-Examples": Forbidden, 195 "WTFPL": Forbidden, 196 197 "AML": Unknown, 198 "AMPAS": Unknown, 199 "ANTLR": Unknown, 200 "AdColony-SDK": Unknown, 201 "Android-SDK": Unknown, 202 "Atmel": Unknown, 203 "Autodesk-3D-Studio-File-Toolkit": Unknown, 204 "BLAS": Unknown, 205 "BSD-FatFs": Unknown, 206 "BSD-No-Other-Rights": Unknown, 207 "BSD-Rice": Unknown, 208 "BSD-Source-Code": Unknown, 209 "BabelstoneIDS": Unknown, 210 "BeOpen": Unknown, 211 "Beerware": Unknown, 212 "BitTorrent-1.1": Unknown, 213 "Bitstream": Unknown, 214 "Boost-original": Unknown, 215 "Business-Source-License-1.1": Unknown, 216 "CAL-1.0": Unknown, 217 "CDLA-Permissive-1.0": Unknown, 218 "CECILL-2.1": Unknown, 219 "CERN-OHL-WR-v2": Unknown, 220 "CERN-OHL-v1.2": Unknown, 221 "CLIPS": Unknown, 222 "CNRI-Python-GPL-Compatible": Unknown, 223 "CPAL-1.0": Unknown, 224 "Cloud-Pre-GA": Unknown, 225 "DBAD": Unknown, 226 "DRL-1.0": Unknown, 227 "EUPL-1.0": Unknown, 228 "EUPL-1.1": Unknown, 229 "Elastic-2.0": Unknown, 230 "Entenssa": Unknown, 231 "FFT2D": Unknown, 232 "GD-Graphic-Library": Unknown, 233 "GIAJWTOU-2.0": Unknown, 234 "GIF-Encoder": Unknown, 235 "GNU-All-permissive-Copying-License": Unknown, 236 "GUST-Font-License": Unknown, 237 "GenericIntel": Unknown, 238 "HDF5": Unknown, 239 "HPND-sell-variant": Unknown, 240 "HTK": Unknown, 241 "ICU": Unknown, 242 "IDA": Unknown, 243 "IJG": Unknown, 244 "Info-ZIP": Unknown, 245 "InnerNet": Unknown, 246 "JSON": Unknown, 247 "JTidy": Unknown, 248 "JasPer": Unknown, 249 "KUKA": Unknown, 250 "Khronos": Unknown, 251 "Khronos_OpenCL": Unknown, 252 "LGPLLR": Unknown, 253 "LPPL-1.3c": Unknown, 254 "LZMA": Unknown, 255 "Lattice-Semiconductor": Unknown, 256 "LicenseRef-C-Ares": Unknown, 257 "LicenseRef-MIT-Lucent": Unknown, 258 "LicenseRef-Nordic-binary": Unknown, 259 "LicenseRef-SendMail": Unknown, 260 "LicenseRef-iccjpeg": Unknown, 261 "LicenseRef-nacl": Unknown, 262 "LicenseRef-takuya-ooura": Unknown, 263 "LicenseRef-uthash": Unknown, 264 "MIT-Modern-Variant": Unknown, 265 "MPL-2.0-no-copyleft-exception": Unknown, 266 "MS-RL": Unknown, 267 "MTK": Unknown, 268 "NAIST-2003": Unknown, 269 "NCBI": Unknown, 270 "NGPL": Unknown, 271 "NREL": Unknown, 272 "OFL-1.1": Unknown, 273 "OROMatcher": Unknown, 274 "Open-Game-License-1.0a": Unknown, 275 "OpenLDAP": Unknown, 276 "OpenVision": Unknown, 277 "Oracle-Open-Symphony": Unknown, 278 "PNG": Unknown, 279 "PPP": Unknown, 280 "Qhull": Unknown, 281 "RCSB-PDB": Unknown, 282 "RSA": Unknown, 283 "Rijndael-3.0": Unknown, 284 "SISSL": Unknown, 285 "SISSL-1.2": Unknown, 286 "SPL-SQRT-FLOOR": Unknown, 287 "SQLite": Unknown, 288 "SSPL-1.0": Unknown, 289 "Sflow": Unknown, 290 "Spencer-86": Unknown, 291 "SunPro": Unknown, 292 "TPM-2": Unknown, 293 "Tensilica": Unknown, 294 "UFL-1.0": Unknown, 295 "USGovernment": Unknown, 296 "VMAC": Unknown, 297 "Vim": Unknown, 298 "Waymo1P": Unknown, 299 "Windows-SDK-10": Unknown, 300 "WordNet-3.0": Unknown, 301 "X11-Lucent": Unknown, 302 "XZ": Unknown, 303 "Xcode": Unknown, 304 "Zendesk": Unknown, 305 "aopalliance": Unknown, 306 "blessing": Unknown, 307 "bzip2": Unknown, 308 "cURL": Unknown, 309 "dso": Unknown, 310 "eGenix": Unknown, 311 "geant4": Unknown, 312 "getopt": Unknown, 313 "hdparm": Unknown, 314 "libtiff": Unknown, 315 "pffft": Unknown, 316 "re2c": Unknown, 317 "tcl_tk": Unknown, 318 "unicode_org": Unknown, 319 "wxWindows-3.1": Unknown, 320 } 321 322 func LicenseType(license string) Type { 323 if t, ok := typeMap[license]; ok { 324 return t 325 } 326 327 return Unknown 328 }