gomobiledetect
gomobiledetect copied to clipboard
Go Mobile Detect is a lightweight Go package imported from PHP for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile...
GoMobileDetect
Description
GoMobileDetect is a lightweight package imported from PHP for detecting mobile devices including tablets.
The package is imported from MobileDetect which was originally written in PHP.
Installation
$ go get github.com/Shaked/gomobiledetect
Updates
Version 1.2.0
- Now supports using
Http.Handlerimplementation. See examples
Version 1.0.0
- The package name had been changed to mobiledetect.
Version 0.2.0
-
This version introduces a new method
IsKey(key int). This method is faster than theIs(key string). All keys can be found here -
The
Is(key string)has been changed to support bothstringandintusing theinterface{}.
Benchmarking
Version 0.1.2
BenchmarkIsMobile 2000 1001884 ns/op
ok github.com/Shaked/gomobiledetect 7.091s
Version 0.2.0
BenchmarkIsMobile 100000 19278 ns/op
ok github.com/Shaked/gomobiledetect 7.448s
Usage
There are different ways of using the package:
- Basic usage
- Basic router implementation
- Handler interface implementation
- Mux interface implementation
License
Go Mobile Detect is an open-source script released under MIT License.


