mirror of
https://github.com/sascha-hemi/spaceDevices.git
synced 2026-03-21 03:04:20 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5841f74693 | ||
|
|
7797f25911 | ||
|
|
09524c20a6 | ||
|
|
250568578a | ||
|
|
8270fdff90 | ||
|
|
acf1c71198 | ||
|
|
973d9fcacb | ||
|
|
06f8a14444 | ||
|
|
2f7f2df786 | ||
|
|
02c7464ce2 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -3,4 +3,8 @@
|
||||
config.toml
|
||||
vendor/
|
||||
userDb.json
|
||||
masterDb.json
|
||||
masterDb.json
|
||||
extras/*.csv
|
||||
macVendorDb.csv
|
||||
listUnkown
|
||||
spaceDevices
|
||||
819
Gopkg.lock
generated
819
Gopkg.lock
generated
@@ -2,116 +2,873 @@
|
||||
|
||||
|
||||
[[projects]]
|
||||
branch = "default"
|
||||
digest = "1:948d94ecc3bcce79f850400744f69d795ef7a750e7486ef8d0ef40a95eb9c3ee"
|
||||
name = "bitbucket.org/bodhisnarkva/cbor"
|
||||
packages = ["go"]
|
||||
pruneopts = ""
|
||||
revision = "113f42203c941470c98f7174065ba9b384cff727"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:cb193a00b8b032b70a5bad3b57da90867fcfea7e3d23581e71dda50fca9cecd5"
|
||||
name = "cloud.google.com/go"
|
||||
packages = [
|
||||
".",
|
||||
"compute/metadata",
|
||||
"iam",
|
||||
"internal",
|
||||
"internal/optional",
|
||||
"internal/trace",
|
||||
"internal/version",
|
||||
"storage",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "e5804108aed715c49f731aab1a847f063fb23681"
|
||||
version = "v0.50.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:289dd4d7abfb3ad2b5f728fbe9b1d5c1bf7d265a3eb9ef92869af1f7baba4c7a"
|
||||
name = "github.com/BurntSushi/toml"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "b26d9c308763d68093482582cea63d69be07a0f0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a8062972611c57205bf50c1a6fd639883b8a18288e8423549c27f6adac055ea7"
|
||||
name = "github.com/DataDog/zstd"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "8fdb579680349497546a04291cedfff98a7829a0"
|
||||
version = "v1.4.4"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4139df3eb46aea1ebebee02c0453bd45850c21db8ced404b0f13289f21d11bbd"
|
||||
name = "github.com/Sereal/Sereal"
|
||||
packages = ["Go/sereal"]
|
||||
pruneopts = ""
|
||||
revision = "df33d1c458d3baeb3c34ef319f30b940688a1964"
|
||||
version = "v1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0deddd908b6b4b768cfc272c16ee61e7088a60f7fe2f06c547bd3d8e1f8b8e77"
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
packages = [
|
||||
"spew",
|
||||
"spew/testdata",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:c5c7cef0066cca569e1f59c7856ab897c288a7b19bb0e829793a012189dd06cf"
|
||||
name = "github.com/davecgh/go-xdr"
|
||||
packages = ["xdr2"]
|
||||
pruneopts = ""
|
||||
revision = "e6a2ba005892b6a5b27cb5352f64c2e96942dd28"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:899ab67e7a794d8c454b4e6088c7cb85e6b7b4ec9cf5c94d6c742eb8b2e7da26"
|
||||
name = "github.com/dchest/uniuri"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "8902c56451e9b58ff940bbe5fec35d5f9c04584a"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:eecb3e6cef98036972582ffff7d3e340aef15f075236da353aa3e7fb798fdb21"
|
||||
name = "github.com/eclipse/paho.mqtt.golang"
|
||||
packages = [".","packets"]
|
||||
packages = [
|
||||
".",
|
||||
"packets",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "aff15770515e3c57fc6109da73d42b0d46f7f483"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:b3e8b1876d3d7179138781b0ef9673554ae103c8002e7d7fea281cfb885e8c80"
|
||||
name = "github.com/gin-contrib/gzip"
|
||||
packages = ["."]
|
||||
revision = "9b22cb967bcc8481c9fe3ab99f70d715f88980f0"
|
||||
pruneopts = ""
|
||||
revision = "3b307ae37dc29cf63f95d0952158172927d7861c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e35353e6b5c1a1350832f2f5ea87f1d42d491ce519bc6e2c65d5dd6d020e2a01"
|
||||
name = "github.com/gin-contrib/sse"
|
||||
packages = ["."]
|
||||
revision = "22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae"
|
||||
pruneopts = ""
|
||||
revision = "54d8467d122d380a14768b6b4e5cd7ca4755938f"
|
||||
version = "v0.1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e11e53fe8a044e4a1e4f4dbec534f00e19d0132535c7fb2e94c7b98ab4c65af8"
|
||||
name = "github.com/gin-gonic/gin"
|
||||
packages = [".","binding","render"]
|
||||
revision = "d459835d2b077e44f7c9b453505ee29881d5d12d"
|
||||
version = "v1.2"
|
||||
packages = [
|
||||
".",
|
||||
"binding",
|
||||
"internal/json",
|
||||
"render",
|
||||
"testdata/protoexample",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "b75d67cd51eb53c3c3a2fc406524c940021ffbda"
|
||||
version = "v1.4.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:9b65ba1b0091274d19622cdb1f230771df68716ab9ca340c44e45597a72e290b"
|
||||
name = "github.com/go-playground/locales"
|
||||
packages = [
|
||||
".",
|
||||
"currency",
|
||||
"en",
|
||||
"en_CA",
|
||||
"fr",
|
||||
"id",
|
||||
"ja",
|
||||
"nl",
|
||||
"pt_BR",
|
||||
"tr",
|
||||
"zh",
|
||||
"zh_Hant_TW",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "9f105231d3a5f6877a2bf8321dfa15ea6f844b1b"
|
||||
version = "v0.13.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:b7edb31103e55ef4cf5f6a2b790b34f68f1209590f7f8008115ca09f1fa2a853"
|
||||
name = "github.com/go-playground/universal-translator"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "f87b1403479a348651dbf5f07f5cc6e5fcf07008"
|
||||
version = "v0.17.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a01080d20c45c031c13f3828c56e58f4f51d926a482ad10cc0316225097eb7ea"
|
||||
name = "github.com/go-stack/stack"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "2fee6af1a9795aafbe0253a0cfbdf668e1fb8a9a"
|
||||
version = "v1.8.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = ["proto"]
|
||||
revision = "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9"
|
||||
digest = "1:bd738ea0dd7d1ce14f6410e1a966c946bcb1855db767a16836d5c56ca3f2f2a0"
|
||||
name = "github.com/golang/groupcache"
|
||||
packages = ["lru"]
|
||||
pruneopts = ""
|
||||
revision = "215e87163ea771ffa998a96c611387313bb5a403"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:b852d2b62be24e445fcdbad9ce3015b44c207815d631230dfce3f14e7803f5bf"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"descriptor",
|
||||
"jsonpb/jsonpb_test_proto",
|
||||
"proto",
|
||||
"proto/proto3_proto",
|
||||
"proto/test_proto",
|
||||
"protoc-gen-go",
|
||||
"protoc-gen-go/descriptor",
|
||||
"protoc-gen-go/generator",
|
||||
"protoc-gen-go/generator/internal/remap",
|
||||
"protoc-gen-go/grpc",
|
||||
"protoc-gen-go/plugin",
|
||||
"ptypes",
|
||||
"ptypes/any",
|
||||
"ptypes/duration",
|
||||
"ptypes/struct",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7"
|
||||
version = "v1.3.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:6a6322a15aa8e99bd156fbba0aae4e5d67b4bb05251d860b348a45dfdcba9cce"
|
||||
name = "github.com/golang/snappy"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "2a8bb927dd31d8daada140a5d09578521ce5c36a"
|
||||
version = "v0.0.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8d4a577a9643f713c25a32151c0f26af7228b4b97a219b5ddb7fd38d16f6e673"
|
||||
name = "github.com/google/gofuzz"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "f140a6486e521aad38f5917de355cbf147cc0496"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:6120f027b9d68ef460b8731e27b0dcf2017f80605c17eb0b4cc151866ba38f6d"
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["v2"]
|
||||
pruneopts = ""
|
||||
revision = "bd5b16380fd03dc758d11cef74ba2e3bc8b0e8c2"
|
||||
version = "v2.0.5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:fb8bce9822eac1e2aeee6c2621cf25c6dec8f8f5f50a09a4a894d7932bfb2106"
|
||||
name = "github.com/json-iterator/go"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "acfec88f7a0d5140ace3dcdbee10184e3684a9e1"
|
||||
version = "v1.1.9"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:79842ff66af8c6fbebb418e3403fa3e9fde8e6c82ebffc5272a3dfeaa64c0665"
|
||||
name = "github.com/jstemmer/go-junit-report"
|
||||
packages = [
|
||||
".",
|
||||
"formatter",
|
||||
"parser",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "cc1f095d5cc5eca2844f5c5ea7bb37f6b9bf6cac"
|
||||
version = "v0.9.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0f51cee70b0d254dbc93c22666ea2abf211af81c1701a96d04e2284b408621db"
|
||||
name = "github.com/konsorten/go-windows-terminal-sequences"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "f55edac94c9bbba5d6182a4be46d86a2c9b5b50e"
|
||||
version = "v1.0.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:374148f8cffff6c4fc9def73674b6c104c54b9fe5957f93798b62fa6e1930f29"
|
||||
name = "github.com/kr/pretty"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "4e0886370c3a67530192c6a238cff68f56c141b0"
|
||||
version = "v0.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:11b056b4421396ab14e384ab8ab8c2079b03f1e51aa5eb4d9b81f9e0d1aa8fbf"
|
||||
name = "github.com/kr/text"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "e2ffdb16a802fe2bb95e2e35ff34f0e53aeef34f"
|
||||
version = "v0.1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:eadc94347700e0ea690190ca59cbe66cd9997633fee4344206419e6fc878373e"
|
||||
name = "github.com/leodido/go-urn"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "a0f5013415294bb94553821ace21a1a74c0298cc"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:263db331ad7732d9d1e45003031dd3d6295c0c4be232f99596dde34fa51e3df9"
|
||||
name = "github.com/mailru/easyjson"
|
||||
packages = [
|
||||
".",
|
||||
"buffer",
|
||||
"jlexer",
|
||||
"jwriter",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "1b2b06f5f209fea48ff5922d8bfb2b9ed5d8f00b"
|
||||
version = "v0.7.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:f438921468fbc770ac4c97628f188913a099d4f004226e4aeb6e0f62f5b14fd1"
|
||||
name = "github.com/mattn/go-isatty"
|
||||
packages = ["."]
|
||||
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
|
||||
version = "v0.0.3"
|
||||
pruneopts = ""
|
||||
revision = "31745d66dd679ac0ac4f8d3ecff168fce6170c6a"
|
||||
version = "v0.0.11"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0c0ff2a89c1bb0d01887e1dac043ad7efbf3ec77482ef058ac423d13497e16fd"
|
||||
name = "github.com/modern-go/concurrent"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94"
|
||||
version = "1.0.3"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e32bdbdb7c377a07a9a46378290059822efdce5c8d96fe71940d87cb4f918855"
|
||||
name = "github.com/modern-go/reflect2"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
|
||||
version = "1.0.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:210286d0cb60ffe28f1ca00b664029e8943009f95d06d8f8c336301b28e1aee5"
|
||||
name = "github.com/philhofer/fwd"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "bb6d471dc95d4fe11e432687f8b70ff496cf3136"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:256484dbbcd271f9ecebc6795b2df8cad4c458dd0f5fd82a8c2fa0c29f233411"
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
pruneopts = ""
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = ["."]
|
||||
revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e"
|
||||
version = "v1.0.3"
|
||||
branch = "master"
|
||||
digest = "1:e5971c451b4b385d0b39f6d4fc846d31bb356d80c7ee537f7c40b3b2e496d63b"
|
||||
name = "github.com/pquerna/ffjson"
|
||||
packages = [
|
||||
"ffjson",
|
||||
"fflib/v1",
|
||||
"fflib/v1/internal",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "aa0246cd15f76c96de6b96f22a305bdfb2d1ec02"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:3fcbf733a8d810a21265a7f2fe08a3353db2407da052b233f8b204b5afc03d9b"
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = [
|
||||
".",
|
||||
"hooks/syslog",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "3e01752db0189b9157070a0e1668a620f9a85da2"
|
||||
version = "v1.0.6"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:88e031206b52c11a8442f3f07e9bcddc1b248274d0506c768a948e7e254b84bb"
|
||||
name = "github.com/stretchr/objx"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "ea4fe68685ee0d3cee7032121851b57e7494e8ea"
|
||||
version = "v0.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:3926a4ec9a4ff1a072458451aa2d9b98acd059a45b38f7335d31e06c3d6a0159"
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert"]
|
||||
packages = [
|
||||
"assert",
|
||||
"http",
|
||||
"mock",
|
||||
"require",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
|
||||
version = "v1.1.4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:ba0b08150469673dc06b947a6deb2907831b3b02eb65026393788e8712c5b087"
|
||||
name = "github.com/tinylib/msgp"
|
||||
packages = ["msgp"]
|
||||
pruneopts = ""
|
||||
revision = "490d90d0e69181d9cfedd28343d876cd361adcc3"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:152bb9c7b128f6d8204e1676bb1a79cdaac9b3d40e495048282823ff6f5fb3d4"
|
||||
name = "github.com/ugorji/go"
|
||||
packages = ["codec"]
|
||||
revision = "459bba837a9de7a4d9c58fa5a1171a2a3c96d0d0"
|
||||
pruneopts = ""
|
||||
revision = "23ab95ef5dc3b70286760af84ce2327a2b64ed62"
|
||||
version = "v1.1.7"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:79491b4217db33faa5486cc3787691997e108334ea1940b34aef5aa3af92ea63"
|
||||
name = "go.mongodb.org/mongo-driver"
|
||||
packages = [
|
||||
"bson",
|
||||
"bson/bsoncodec",
|
||||
"bson/bsonoptions",
|
||||
"bson/bsonrw",
|
||||
"bson/bsontype",
|
||||
"bson/primitive",
|
||||
"x/bsonx/bsoncore",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "b414b897457665f12997cefd10ad934ccb9dfb3e"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:61ff2a14b0f9a396d92bb6967ecd1ae4c4767ff3e008acdfd8291af134336d9f"
|
||||
name = "go.opencensus.io"
|
||||
packages = [
|
||||
".",
|
||||
"internal",
|
||||
"internal/tagencoding",
|
||||
"metric/metricdata",
|
||||
"metric/metricproducer",
|
||||
"plugin/ochttp",
|
||||
"plugin/ochttp/propagation/b3",
|
||||
"resource",
|
||||
"stats",
|
||||
"stats/internal",
|
||||
"stats/view",
|
||||
"tag",
|
||||
"trace",
|
||||
"trace/internal",
|
||||
"trace/propagation",
|
||||
"trace/tracestate",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "aad2c527c5defcf89b5afab7f37274304195a6b2"
|
||||
version = "v0.22.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:9c14800d0148726e982a53610f1a040b26070101e3fb6f8cf8071ed987c8a401"
|
||||
name = "go4.org"
|
||||
packages = ["syncutil/singleflight"]
|
||||
pruneopts = ""
|
||||
revision = "c7e774b10ea04ad8fe5241e62ac4bf676c1d6b16"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:1dd434964af165b5ff841d0ba04c25d7a69ddb555d151c7ff413362393f56e81"
|
||||
name = "golang.org/x/build"
|
||||
packages = ["autocertcache"]
|
||||
pruneopts = ""
|
||||
revision = "17a7d8724fa7128cd79bcb78e1fbe087043bf810"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:623570fddb99ef064b125c7bf3161f14aba21fdb787896b6c5070d34187c86f8"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["ssh/terminal"]
|
||||
revision = "2509b142fb2b797aa7587dad548f113b2c0f20ce"
|
||||
packages = [
|
||||
"acme",
|
||||
"acme/autocert",
|
||||
"ssh/terminal",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "53104e6ec876ad4e22ad27cce588b01392043c1b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:3eff8962ec764e09945f32199ca343c798c79b25e69bf5fd813e1aafcd3e50b7"
|
||||
name = "golang.org/x/exp"
|
||||
packages = [
|
||||
"apidiff",
|
||||
"cmd/apidiff",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "da58074b429933d2abeae71d6ef619366febf38e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:465c831311f144be27d64ae3cb416b243ff67e73407852bc4265d09efbb66283"
|
||||
name = "golang.org/x/lint"
|
||||
packages = [
|
||||
".",
|
||||
"golint",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "fdd1cda4f05fd1fd86124f0ef9ce31a0b72c8448"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:cab37ea831bb9be343b41a7673e64b6bb8399bc0f051180c04ce561573ed2c89"
|
||||
name = "golang.org/x/net"
|
||||
packages = ["proxy","websocket"]
|
||||
revision = "c73622c77280266305273cb545f54516ced95b93"
|
||||
packages = [
|
||||
"context",
|
||||
"context/ctxhttp",
|
||||
"dns/dnsmessage",
|
||||
"http/httpguts",
|
||||
"http/httpproxy",
|
||||
"http2",
|
||||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/socks",
|
||||
"internal/sockstest",
|
||||
"internal/timeseries",
|
||||
"nettest",
|
||||
"proxy",
|
||||
"trace",
|
||||
"websocket",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "c0dbc17a35534bf2e581d7a942408dc936316da4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix","windows"]
|
||||
revision = "661970f62f5897bc0cd5fdca7e087ba8a98a8fa1"
|
||||
digest = "1:44d75e002fa89506cca17f921eb07aee69526d7519bb7f1f2b0e017380c5e011"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [
|
||||
".",
|
||||
"google",
|
||||
"internal",
|
||||
"jws",
|
||||
"jwt",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "858c2ad4c8b6c5d10852cb89079f6ca1c7309787"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:8c945c7d15d859d00371d42149761229fcc8dcd839ff2b998defba22fc9f7d24"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"cpu",
|
||||
"unix",
|
||||
"windows",
|
||||
"windows/registry",
|
||||
"windows/svc",
|
||||
"windows/svc/debug",
|
||||
"windows/svc/eventlog",
|
||||
"windows/svc/mgr",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "a1369afcdac740082c63165b07ec83b531884be2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:740b51a55815493a8d0f2b1e0d0ae48fe48953bf7eaf3fcc4198823bf67768c0"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
"collate/build",
|
||||
"internal/colltab",
|
||||
"internal/gen",
|
||||
"internal/language",
|
||||
"internal/language/compact",
|
||||
"internal/tag",
|
||||
"internal/triegen",
|
||||
"internal/ucd",
|
||||
"language",
|
||||
"secure/bidirule",
|
||||
"transform",
|
||||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "342b2e1fbaa52c93f31447ad2c6abc048c63e475"
|
||||
version = "v0.3.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:a4eb4cc7790e58abb47866069f3ef5033c226cded13b9955d6b3af2de34266ac"
|
||||
name = "golang.org/x/tools"
|
||||
packages = [
|
||||
"cmd/goimports",
|
||||
"go/analysis",
|
||||
"go/analysis/passes/inspect",
|
||||
"go/ast/astutil",
|
||||
"go/ast/inspector",
|
||||
"go/buildutil",
|
||||
"go/gcexportdata",
|
||||
"go/internal/gcimporter",
|
||||
"go/internal/packagesdriver",
|
||||
"go/packages",
|
||||
"go/types/objectpath",
|
||||
"go/types/typeutil",
|
||||
"internal/fastwalk",
|
||||
"internal/gopathwalk",
|
||||
"internal/imports",
|
||||
"internal/module",
|
||||
"internal/semver",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "774c71fcf11405d0a5ce0aba75dc113822d62178"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:1e9e6f4d4ca4c890f3de6dbaf071a9a428991c571fbaeae210981729cd19cd1a"
|
||||
name = "google.golang.org/api"
|
||||
packages = [
|
||||
"googleapi",
|
||||
"googleapi/transport",
|
||||
"internal",
|
||||
"internal/gensupport",
|
||||
"internal/third_party/uritemplates",
|
||||
"iterator",
|
||||
"option",
|
||||
"storage/v1",
|
||||
"transport/http",
|
||||
"transport/http/internal/propagation",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "aa5d4e47691e7ae1aebb5221ff8e4beea23fad72"
|
||||
version = "v0.15.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c4404231035fad619a12f82ae3f0f8f9edc1cc7f34e7edad7a28ccac5336cc96"
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [
|
||||
".",
|
||||
"datastore",
|
||||
"datastore/internal/cloudkey",
|
||||
"datastore/internal/cloudpb",
|
||||
"internal",
|
||||
"internal/app_identity",
|
||||
"internal/base",
|
||||
"internal/datastore",
|
||||
"internal/log",
|
||||
"internal/modules",
|
||||
"internal/remote_api",
|
||||
"internal/urlfetch",
|
||||
"urlfetch",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "971852bfffca25b069c31162ae8f247a3dba083b"
|
||||
version = "v1.6.5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:ba64d3acd79ad4dee34b76de29a73959114a204f1f35791807171a152d41aa38"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = [
|
||||
"googleapis/api/annotations",
|
||||
"googleapis/iam/v1",
|
||||
"googleapis/rpc/code",
|
||||
"googleapis/rpc/status",
|
||||
"googleapis/type/expr",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "f3c370f40bfba3cb25c5c2f823a1a8031b5ad724"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:7af390490e636a6adc9c76b37a3c823195fbf375a02c4d9506b4dd49d5d2409a"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
"attributes",
|
||||
"backoff",
|
||||
"balancer",
|
||||
"balancer/base",
|
||||
"balancer/roundrobin",
|
||||
"binarylog/grpc_binarylog_v1",
|
||||
"codes",
|
||||
"connectivity",
|
||||
"credentials",
|
||||
"credentials/internal",
|
||||
"encoding",
|
||||
"encoding/proto",
|
||||
"grpclog",
|
||||
"internal",
|
||||
"internal/backoff",
|
||||
"internal/balancerload",
|
||||
"internal/binarylog",
|
||||
"internal/buffer",
|
||||
"internal/channelz",
|
||||
"internal/envconfig",
|
||||
"internal/grpcrand",
|
||||
"internal/grpcsync",
|
||||
"internal/resolver/dns",
|
||||
"internal/resolver/passthrough",
|
||||
"internal/syscall",
|
||||
"internal/transport",
|
||||
"keepalive",
|
||||
"metadata",
|
||||
"naming",
|
||||
"peer",
|
||||
"resolver",
|
||||
"serviceconfig",
|
||||
"stats",
|
||||
"status",
|
||||
"tap",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "f5b0812e6fe574d90da76b205e9eb51f6ddb1919"
|
||||
version = "v1.26.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "v1"
|
||||
digest = "1:bfac5904967a4e939d169f6584184c86a67346d6efa2c02eef110d4d7179ba1f"
|
||||
name = "gopkg.in/check.v1"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "41f04d3bba152ddec2103e299fed053415705330"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0b15aebd8a84d06f487fddc8a8ffc8be02c23faf1a382b06d3a0c56f32417614"
|
||||
name = "gopkg.in/go-playground/assert.v1"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "4f4dfbc7d1c48336cf93399deae81aa9067e88af"
|
||||
version = "v1.2.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:dd549e360e5a8f982a28c2bcbe667307ceffe538ed9afc7c965524f1ac285b3f"
|
||||
name = "gopkg.in/go-playground/validator.v8"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "5f1438d3fca68893a817e4a66806cea46a9e4ebf"
|
||||
version = "v8.18.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a4b477a58cba8512494a4cacd5c1beb61c17ac04599da9910cac40a413686449"
|
||||
name = "gopkg.in/go-playground/validator.v9"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "21c910fc6d9c3556c28252b04beb17de0c2d40ec"
|
||||
version = "v9.31.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "v2"
|
||||
digest = "1:e56755c5336ff37d20befca76df29097085c85ea1fe58af746e3df6b815decfa"
|
||||
name = "gopkg.in/mgo.v2"
|
||||
packages = [
|
||||
"bson",
|
||||
"internal/json",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "a6b53ec6cb22a3699387a57a161566f9402ee85b"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:73e1c6c853e6e6d8aa8f7f04de048430cac006b0c8d1153775304297aca6eea7"
|
||||
name = "gopkg.in/vmihailenco/msgpack.v2"
|
||||
packages = [
|
||||
".",
|
||||
"codes",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "f4f8982de4ef0de18be76456617cc3f5d8d8141e"
|
||||
version = "v2.9.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5a53f6ef09fb1ac261a97f8a72e8837ff53cbaa969022a6679da210e4cbe9b0f"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
|
||||
pruneopts = ""
|
||||
revision = "1f64d6156d11335c3f22d9330b0ad14fc1e789ce"
|
||||
version = "v2.2.7"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:afc5a2804ec9be0562c937b0c684bbaf5a9c4aef7511677b539c3806be3f4783"
|
||||
name = "honnef.co/go/tools"
|
||||
packages = [
|
||||
"arg",
|
||||
"cmd/staticcheck",
|
||||
"config",
|
||||
"deprecated",
|
||||
"facts",
|
||||
"functions",
|
||||
"go/types/typeutil",
|
||||
"internal/cache",
|
||||
"internal/passes/buildssa",
|
||||
"internal/renameio",
|
||||
"internal/sharedcheck",
|
||||
"lint",
|
||||
"lint/lintdsl",
|
||||
"lint/lintutil",
|
||||
"lint/lintutil/format",
|
||||
"loader",
|
||||
"printf",
|
||||
"simple",
|
||||
"ssa",
|
||||
"ssautil",
|
||||
"staticcheck",
|
||||
"staticcheck/vrp",
|
||||
"stylecheck",
|
||||
"unused",
|
||||
"version",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "afd67930eec2a9ed3e9b19f684d17a062285f16a"
|
||||
version = "2019.2.3"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "13743fcc4cbd00e607d2f15ef32adb097b9e3fec858d56d2ffb0d753b998f7ee"
|
||||
input-imports = [
|
||||
"bitbucket.org/bodhisnarkva/cbor/go",
|
||||
"cloud.google.com/go/storage",
|
||||
"github.com/BurntSushi/toml",
|
||||
"github.com/Sereal/Sereal/Go/sereal",
|
||||
"github.com/davecgh/go-spew/spew",
|
||||
"github.com/davecgh/go-spew/spew/testdata",
|
||||
"github.com/davecgh/go-xdr/xdr2",
|
||||
"github.com/dchest/uniuri",
|
||||
"github.com/eclipse/paho.mqtt.golang",
|
||||
"github.com/eclipse/paho.mqtt.golang/packets",
|
||||
"github.com/gin-contrib/gzip",
|
||||
"github.com/gin-gonic/gin",
|
||||
"github.com/gin-gonic/gin/internal/json",
|
||||
"github.com/gin-gonic/gin/testdata/protoexample",
|
||||
"github.com/go-playground/locales",
|
||||
"github.com/go-playground/locales/currency",
|
||||
"github.com/go-playground/locales/en",
|
||||
"github.com/go-playground/locales/en_CA",
|
||||
"github.com/go-playground/locales/fr",
|
||||
"github.com/go-playground/locales/id",
|
||||
"github.com/go-playground/locales/ja",
|
||||
"github.com/go-playground/locales/nl",
|
||||
"github.com/go-playground/locales/pt_BR",
|
||||
"github.com/go-playground/locales/tr",
|
||||
"github.com/go-playground/locales/zh",
|
||||
"github.com/go-playground/locales/zh_Hant_TW",
|
||||
"github.com/go-playground/universal-translator",
|
||||
"github.com/golang/protobuf/descriptor",
|
||||
"github.com/golang/protobuf/jsonpb/jsonpb_test_proto",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/golang/protobuf/proto/proto3_proto",
|
||||
"github.com/golang/protobuf/proto/test_proto",
|
||||
"github.com/golang/protobuf/protoc-gen-go/descriptor",
|
||||
"github.com/golang/protobuf/protoc-gen-go/generator",
|
||||
"github.com/golang/protobuf/protoc-gen-go/generator/internal/remap",
|
||||
"github.com/golang/protobuf/protoc-gen-go/grpc",
|
||||
"github.com/golang/protobuf/protoc-gen-go/plugin",
|
||||
"github.com/golang/protobuf/ptypes",
|
||||
"github.com/golang/protobuf/ptypes/any",
|
||||
"github.com/golang/protobuf/ptypes/duration",
|
||||
"github.com/golang/protobuf/ptypes/struct",
|
||||
"github.com/golang/protobuf/ptypes/timestamp",
|
||||
"github.com/golang/protobuf/ptypes/wrappers",
|
||||
"github.com/google/gofuzz",
|
||||
"github.com/json-iterator/go",
|
||||
"github.com/konsorten/go-windows-terminal-sequences",
|
||||
"github.com/leodido/go-urn",
|
||||
"github.com/mailru/easyjson",
|
||||
"github.com/mattn/go-isatty",
|
||||
"github.com/modern-go/concurrent",
|
||||
"github.com/modern-go/reflect2",
|
||||
"github.com/pmezard/go-difflib/difflib",
|
||||
"github.com/pquerna/ffjson/ffjson",
|
||||
"github.com/sirupsen/logrus",
|
||||
"github.com/sirupsen/logrus/hooks/syslog",
|
||||
"github.com/stretchr/objx",
|
||||
"github.com/stretchr/testify/assert",
|
||||
"github.com/stretchr/testify/http",
|
||||
"github.com/stretchr/testify/mock",
|
||||
"github.com/stretchr/testify/require",
|
||||
"github.com/tinylib/msgp/msgp",
|
||||
"github.com/ugorji/go/codec",
|
||||
"go.mongodb.org/mongo-driver/bson",
|
||||
"go4.org/syncutil/singleflight",
|
||||
"golang.org/x/build/autocertcache",
|
||||
"golang.org/x/crypto/acme/autocert",
|
||||
"golang.org/x/crypto/ssh/terminal",
|
||||
"golang.org/x/net/dns/dnsmessage",
|
||||
"golang.org/x/net/http/httpguts",
|
||||
"golang.org/x/net/http/httpproxy",
|
||||
"golang.org/x/net/http2",
|
||||
"golang.org/x/net/http2/hpack",
|
||||
"golang.org/x/net/idna",
|
||||
"golang.org/x/net/internal/socks",
|
||||
"golang.org/x/net/internal/sockstest",
|
||||
"golang.org/x/net/nettest",
|
||||
"golang.org/x/net/proxy",
|
||||
"golang.org/x/net/websocket",
|
||||
"golang.org/x/sys/cpu",
|
||||
"golang.org/x/sys/unix",
|
||||
"golang.org/x/sys/windows",
|
||||
"golang.org/x/sys/windows/registry",
|
||||
"golang.org/x/sys/windows/svc",
|
||||
"golang.org/x/sys/windows/svc/debug",
|
||||
"golang.org/x/sys/windows/svc/eventlog",
|
||||
"golang.org/x/sys/windows/svc/mgr",
|
||||
"golang.org/x/text/unicode/cldr",
|
||||
"golang.org/x/tools/go/packages",
|
||||
"gopkg.in/check.v1",
|
||||
"gopkg.in/go-playground/assert.v1",
|
||||
"gopkg.in/go-playground/validator.v9",
|
||||
"gopkg.in/mgo.v2/bson",
|
||||
"gopkg.in/vmihailenco/msgpack.v2",
|
||||
"gopkg.in/yaml.v2",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
||||
11
Gopkg.toml
11
Gopkg.toml
@@ -20,14 +20,15 @@
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
|
||||
ignored = ["github.com/sirupsen/logrus/internal/testutils"]
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/sirupsen/logrus"
|
||||
version = "1.0.3"
|
||||
version = "=1.0.6"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gin-gonic/gin"
|
||||
version = "1.2.0"
|
||||
version = "=1.4.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
@@ -35,15 +36,15 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/BurntSushi/toml"
|
||||
version = "0.3.0"
|
||||
version = "=0.3.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/eclipse/paho.mqtt.golang"
|
||||
version = "1.1.0"
|
||||
version = "=1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/stretchr/testify"
|
||||
version = "1.1.4"
|
||||
version = "=1.1.4"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/ktt-ol/spaceDevices/conf"
|
||||
"github.com/ktt-ol/spaceDevices/db"
|
||||
"github.com/ktt-ol/spaceDevices/mqtt"
|
||||
"github.com/ktt-ol/spaceDevices/webService"
|
||||
"github.com/ktt-ol/spaceDevices/internal/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/db"
|
||||
"github.com/ktt-ol/spaceDevices/internal/mqtt"
|
||||
"github.com/ktt-ol/spaceDevices/internal/webService"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -31,8 +31,9 @@ func main() {
|
||||
userDb := db.NewUserDb(config.MacDb)
|
||||
masterDb := db.NewMasterDb(config.MacDb)
|
||||
|
||||
mqttHandler := mqtt.NewMqttHandler(config.Mqtt)
|
||||
mqttHandler := mqtt.NewMqttHandler(config.Mqtt, false)
|
||||
data := mqtt.NewDeviceData(config.Locations, mqttHandler, masterDb, userDb)
|
||||
data.ListenAndUpdatePeopleData()
|
||||
|
||||
webService.StartWebService(config.Server, data, userDb)
|
||||
}
|
||||
73
cmd/unkownDevices/listUnkown.go
Normal file
73
cmd/unkownDevices/listUnkown.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"github.com/ktt-ol/spaceDevices/internal/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/db"
|
||||
"github.com/ktt-ol/spaceDevices/internal/mqtt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const CONFIG_FILE = "config.toml"
|
||||
|
||||
const (
|
||||
InfoColor = "\033[1;34m%s\033[0m"
|
||||
NoticeColor = "\033[1;36m%s\033[0m"
|
||||
WarningColor = "\033[1;33m%s\033[0m"
|
||||
ErrorColor = "\033[1;31m%s\033[0m"
|
||||
DebugColor = "\033[0;36m%s\033[0m"
|
||||
PrintColor = "\033[38;5;%dm%s\033[39;49m\n"
|
||||
)
|
||||
|
||||
func main() {
|
||||
config := conf.LoadConfig(CONFIG_FILE)
|
||||
|
||||
userDb := db.NewUserDb(config.MacDb)
|
||||
masterDb := db.NewMasterDb(config.MacDb)
|
||||
|
||||
mqttHandler := mqtt.NewMqttHandler(config.Mqtt, true)
|
||||
data := mqtt.NewDeviceData(config.Locations, mqttHandler, masterDb, userDb)
|
||||
unknownSession := data.GetOneEntry()
|
||||
|
||||
macDb := loadMacDb()
|
||||
for _, s := range unknownSession {
|
||||
// 5c:51:4f
|
||||
firstHexBytes := strings.ToUpper(strings.ReplaceAll(s.Mac[0:8], ":", ""))
|
||||
name, ok := macDb[firstHexBytes]
|
||||
if !ok {
|
||||
name = "Unknown"
|
||||
}
|
||||
fmt.Printf("%s %s\n", fmt.Sprintf(InfoColor, s.Mac), name)
|
||||
fmt.Printf("-> %s // %s\n", s.Ipv4, s.Ipv6)
|
||||
jsonEntry := fmt.Sprintf(`"%s":{"name": "%s", "device-type": "", "visibility": "ignore"},`, s.Mac, name)
|
||||
fmt.Println(jsonEntry)
|
||||
fmt.Println("")
|
||||
}
|
||||
}
|
||||
|
||||
func loadMacDb() map[string]string {
|
||||
file, err := os.Open("macVendorDb.csv")
|
||||
check(err)
|
||||
defer file.Close()
|
||||
|
||||
macDb := make(map[string]string)
|
||||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
assignment := line[0:6]
|
||||
name := line[7:]
|
||||
macDb[assignment] = name
|
||||
}
|
||||
|
||||
check(scanner.Err())
|
||||
|
||||
return macDb
|
||||
}
|
||||
|
||||
func check(e error) {
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
}
|
||||
18
do.sh
18
do.sh
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
echo "Usage $0 (build-linux|test-sync|sync)"
|
||||
echo "Usage $0 (build-linux|docker-image|docker-dep|docker-build|test-sync|sync)"
|
||||
}
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
@@ -13,13 +13,23 @@ fi
|
||||
while (( "$#" )); do
|
||||
case "$1" in
|
||||
build-linux)
|
||||
env GOOS=linux GOARCH=amd64 go build cmd/spaceDevices.go
|
||||
env GOOS=linux GOARCH=amd64 go build cmd/spaceDevices/spaceDevices.go
|
||||
env GOOS=linux GOARCH=amd64 go build cmd/unkownDevices/listUnkown.go
|
||||
;;
|
||||
docker-image)
|
||||
docker build -t space-devices-build docker/
|
||||
;;
|
||||
docker-dep)
|
||||
docker run --rm -it -v $(pwd):/go/src/github.com/ktt-ol/spaceDevices -u $(id -u):$(id -g) space-devices-build dep ensure -v -vendor-only
|
||||
;;
|
||||
docker-build)
|
||||
docker run --rm -it -v $(pwd):/go/src/github.com/ktt-ol/spaceDevices -u $(id -u):$(id -g) space-devices-build ./do.sh build-linux
|
||||
;;
|
||||
test-sync)
|
||||
rsync -n -avzi --delete spaceDevices webUI root@spacegate:/home/status/spaceDevices2/
|
||||
rsync -n -avzi --delete spaceDevices listUnkown webUI macVendorDb.csv root@spacegate:/home/status/spaceDevices2/
|
||||
;;
|
||||
sync)
|
||||
rsync -avzi --delete spaceDevices webUI root@spacegate:/home/status/spaceDevices2/
|
||||
rsync -avzi --delete spaceDevices listUnkown webUI macVendorDb.csv root@spacegate:/home/status/spaceDevices2/
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
|
||||
7
docker/Dockerfile
Normal file
7
docker/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM golang:1.13
|
||||
|
||||
RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/0.5.2/dep-linux-amd64 && chmod +x /usr/local/bin/dep
|
||||
RUN mkdir -p /go/src/github.com/ktt-ol/spaceDevices
|
||||
|
||||
ENV HOME=/tmp
|
||||
WORKDIR /go/src/github.com/ktt-ol/spaceDevices
|
||||
19
docker/README.md
Normal file
19
docker/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Build with docker
|
||||
|
||||
Use the `do.sh` script file in the top directory.
|
||||
|
||||
## Build the docker image
|
||||
|
||||
```shell script
|
||||
./do.sh docker-image
|
||||
```
|
||||
|
||||
## Build binary
|
||||
|
||||
```shell script
|
||||
# installs dependencies, only once needed
|
||||
./do.sh docker-dep
|
||||
|
||||
# build the binary
|
||||
./do.sh docker-build
|
||||
```
|
||||
5
extras/README.md
Normal file
5
extras/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# build mac vendor db
|
||||
|
||||
1. Download the "MAC Address Block Large" (oui.csv) from here
|
||||
https://regauth.standards.ieee.org/standards-ra-web/pub/view.html#registries
|
||||
2. Convert: `./convertOui.py > ../macVendorDb.csv`
|
||||
12
extras/convertOui.py
Executable file
12
extras/convertOui.py
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import csv
|
||||
|
||||
with open('oui.csv', newline='') as csvfile:
|
||||
oui = csv.reader(csvfile, delimiter=',', quotechar='"')
|
||||
skipFirst = True
|
||||
for row in oui:
|
||||
if skipFirst:
|
||||
skipFirst = False
|
||||
continue
|
||||
print('%s,%s' % (row[1], row[2]))
|
||||
@@ -1,9 +1,9 @@
|
||||
package conf_test
|
||||
package conf
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ktt-ol/spaceDevices/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/confrnal/conf"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/ktt-ol/spaceDevices/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/conf"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"io/ioutil"
|
||||
"sync"
|
||||
|
||||
"github.com/ktt-ol/spaceDevices/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/conf"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -9,6 +9,6 @@ func IsMacLocallyAdministered(mac string) bool {
|
||||
const mask = 1 << 1
|
||||
|
||||
first2chars := mac[:2]
|
||||
decimal, _ := strconv.ParseInt(first2chars, 16, 8)
|
||||
decimal, _ := strconv.ParseInt(first2chars, 16, 64)
|
||||
return (decimal & mask) == mask
|
||||
}
|
||||
@@ -3,13 +3,14 @@ package mqtt
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/ktt-ol/spaceDevices/conf"
|
||||
"github.com/ktt-ol/spaceDevices/db"
|
||||
"github.com/ktt-ol/spaceDevices/internal/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/db"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"bytes"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"bytes"
|
||||
"github.com/ktt-ol/spaceDevices/pkg/structs"
|
||||
"github.com/sirupsen/logrus"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
@@ -22,7 +23,7 @@ var ddLogger = logrus.WithField("where", "deviceData")
|
||||
type devicesEntry struct {
|
||||
hideName bool
|
||||
showDevices bool
|
||||
devices []Devices
|
||||
devices []structs.Devices
|
||||
}
|
||||
|
||||
type DeviceData struct {
|
||||
@@ -30,7 +31,7 @@ type DeviceData struct {
|
||||
mqttHandler *MqttHandler
|
||||
masterDb db.MasterDb
|
||||
userDb db.UserDb
|
||||
wifiSessionList []WifiSession
|
||||
wifiSessionList []structs.WifiSession
|
||||
|
||||
lastSentHash []byte
|
||||
|
||||
@@ -39,15 +40,40 @@ type DeviceData struct {
|
||||
|
||||
func NewDeviceData(locations []conf.Location, mqttHandler *MqttHandler, masterDb db.MasterDb, userDb db.UserDb) *DeviceData {
|
||||
dd := DeviceData{locations: locations, mqttHandler: mqttHandler, masterDb: masterDb, userDb: userDb}
|
||||
return &dd
|
||||
}
|
||||
|
||||
func (d *DeviceData) ListenAndUpdatePeopleData() {
|
||||
go func() {
|
||||
for {
|
||||
data := <-mqttHandler.GetNewDataChannel()
|
||||
dd.newData(data)
|
||||
data := <-d.mqttHandler.GetNewDataChannel()
|
||||
d.newData(data)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return &dd
|
||||
func (d *DeviceData) GetOneEntry() []structs.WifiSession {
|
||||
data := <-d.mqttHandler.GetNewDataChannel()
|
||||
sessionsList := d.unmarshal(data)
|
||||
if sessionsList == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
unknownSession := make([]structs.WifiSession, 0, len(sessionsList))
|
||||
for _, wifiSession := range sessionsList {
|
||||
_, ok := d.masterDb.Get(wifiSession.Mac)
|
||||
if ok {
|
||||
continue
|
||||
}
|
||||
_, ok = d.userDb.Get(wifiSession.Mac)
|
||||
if ok {
|
||||
continue
|
||||
}
|
||||
|
||||
unknownSession = append(unknownSession, wifiSession)
|
||||
}
|
||||
|
||||
return unknownSession
|
||||
}
|
||||
|
||||
func (d *DeviceData) newData(data []byte) {
|
||||
@@ -74,7 +100,7 @@ func (d *DeviceData) newData(data []byte) {
|
||||
h := md5.New()
|
||||
s := fmt.Sprintf("%v", peopleAndDevices)
|
||||
hash := h.Sum([]byte(s))
|
||||
if bytes.Equal(hash, d.lastSentHash) {
|
||||
if bytes.Equal(hash, d.lastSentHash) {
|
||||
ddLogger.Debug("Nothing changed in people count, skipping mqtt")
|
||||
} else {
|
||||
d.mqttHandler.SendPeopleAndDevices(peopleAndDevices)
|
||||
@@ -84,23 +110,47 @@ func (d *DeviceData) newData(data []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
func (d *DeviceData) GetByIp(ip string) (WifiSession, bool) {
|
||||
for _, v := range d.wifiSessionList {
|
||||
if v.Ip == ip {
|
||||
return v, true
|
||||
// finds the session entry for the given ip v4 or v6 address
|
||||
func (d *DeviceData) GetByIp(ip string) (structs.WifiSession, bool) {
|
||||
if strings.Count(ip, ":") < 2 {
|
||||
// v4
|
||||
for _, v := range d.wifiSessionList {
|
||||
if v.Ipv4 == ip {
|
||||
return v, true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// v6
|
||||
for _, v := range d.wifiSessionList {
|
||||
if len(v.Ipv6) > 0 {
|
||||
for _, v6 := range v.Ipv6 {
|
||||
if v6 == ip {
|
||||
return v, true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return WifiSession{}, false
|
||||
return structs.WifiSession{}, false
|
||||
}
|
||||
|
||||
func (d *DeviceData) parseWifiSessions(rawData []byte) (sessionsList []WifiSession, peopleAndDevices PeopleAndDevices, success bool) {
|
||||
var sessionData map[string]WifiSession
|
||||
func (d *DeviceData) unmarshal(rawData []byte) []structs.WifiSession {
|
||||
var sessionData []structs.WifiSession
|
||||
if err := json.Unmarshal(rawData, &sessionData); err != nil {
|
||||
ddLogger.WithFields(logrus.Fields{
|
||||
"rawData": string(rawData),
|
||||
"error": err,
|
||||
}).Error("Unable to unmarshal wifi session json.")
|
||||
return nil
|
||||
}
|
||||
|
||||
return sessionData
|
||||
}
|
||||
|
||||
func (d *DeviceData) parseWifiSessions(rawData []byte) (sessionsList []structs.WifiSession, peopleAndDevices structs.PeopleAndDevices, success bool) {
|
||||
sessionData := d.unmarshal(rawData)
|
||||
if sessionData == nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -134,7 +184,12 @@ SESSION_LOOP:
|
||||
username2DevicesMap[userInfo.Name] = entry
|
||||
}
|
||||
|
||||
device := Devices{Name: userInfo.DeviceName, Location: d.findLocation(wifiSession.AP)}
|
||||
location := wifiSession.Location
|
||||
if len(location) == 0 {
|
||||
// location attribute not set, resolve the location by the access point id
|
||||
location = d.findLocation(wifiSession.AP)
|
||||
}
|
||||
device := structs.Devices{Name: userInfo.DeviceName, Location: location}
|
||||
entry.devices = append(entry.devices, device)
|
||||
|
||||
if userInfo.Visibility == db.VisibilityIgnore {
|
||||
@@ -162,22 +217,22 @@ SESSION_LOOP:
|
||||
}
|
||||
}
|
||||
|
||||
peopleAndDevices.People = make([]Person, 0, 10)
|
||||
peopleAndDevices.People = make([]structs.Person, 0, 10)
|
||||
for username, devicesEntry := range username2DevicesMap {
|
||||
if devicesEntry.hideName {
|
||||
continue
|
||||
}
|
||||
|
||||
var person Person
|
||||
var person structs.Person
|
||||
if devicesEntry.showDevices {
|
||||
person = Person{Name: username, Devices: devicesEntry.devices}
|
||||
sort.Sort(DevicesSorter(person.Devices))
|
||||
person = structs.Person{Name: username, Devices: devicesEntry.devices}
|
||||
sort.Sort(structs.DevicesSorter(person.Devices))
|
||||
} else {
|
||||
person = Person{Name: username}
|
||||
person = structs.Person{Name: username}
|
||||
}
|
||||
peopleAndDevices.People = append(peopleAndDevices.People, person)
|
||||
}
|
||||
sort.Sort(PersonSorter(peopleAndDevices.People))
|
||||
sort.Sort(structs.PersonSorter(peopleAndDevices.People))
|
||||
|
||||
success = true
|
||||
return
|
||||
@@ -3,124 +3,25 @@ package mqtt
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/ktt-ol/spaceDevices/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/conf"
|
||||
|
||||
"github.com/ktt-ol/spaceDevices/db"
|
||||
"github.com/ktt-ol/spaceDevices/internal/db"
|
||||
"github.com/ktt-ol/spaceDevices/pkg/structs"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_parseWifiSessions(t *testing.T) {
|
||||
const testData = `
|
||||
{
|
||||
"38126": {
|
||||
"last-auth": 1509210709,
|
||||
"vlan": "default",
|
||||
"stats": {
|
||||
"rx-multicast-pkts": 499,
|
||||
"rx-unicast-pkts": 1817,
|
||||
"tx-unicast-pkts": 734,
|
||||
"rx-unicast-bytes": 156208,
|
||||
"tx-unicast-bytes": 272461,
|
||||
"rx-multicast-bytes": 76808
|
||||
},
|
||||
"ssid": "mainframe",
|
||||
"ip": "192.168.2.127",
|
||||
"hostname": "-",
|
||||
"last-snr": 40,
|
||||
"last-rate-mbits": "24",
|
||||
"ap": 2,
|
||||
"mac": "2c:0e:3d:aa:aa:aa",
|
||||
"radio": 2,
|
||||
"userinfo": null,
|
||||
"session-start": 1509210709,
|
||||
"last-rssi-dbm": -55,
|
||||
"last-activity": 1509211581
|
||||
},
|
||||
"38134": {
|
||||
"last-auth": 1509211121,
|
||||
"vlan": "default",
|
||||
"stats": {
|
||||
"rx-multicast-pkts": 0,
|
||||
"rx-unicast-pkts": 292,
|
||||
"tx-unicast-pkts": 654,
|
||||
"rx-unicast-bytes": 20510,
|
||||
"tx-unicast-bytes": 278565,
|
||||
"rx-multicast-bytes": 0
|
||||
},
|
||||
"ssid": "mainframe",
|
||||
"ip": "192.168.2.179",
|
||||
"hostname": "-",
|
||||
"last-snr": 47,
|
||||
"last-rate-mbits": "6",
|
||||
"ap": 1,
|
||||
"mac": "10:68:3f:bb:bb:bb",
|
||||
"radio": 2,
|
||||
"userinfo": {
|
||||
"name": "Holger",
|
||||
"visibility": "show",
|
||||
"ts": 1427737817755
|
||||
},
|
||||
"session-start": 1509211121,
|
||||
"last-rssi-dbm": -48,
|
||||
"last-activity": 1509211584
|
||||
},
|
||||
"38135": {
|
||||
"last-auth": 1509211163,
|
||||
"vlan": "default",
|
||||
"stats": {
|
||||
"rx-multicast-pkts": 114,
|
||||
"rx-unicast-pkts": 8119,
|
||||
"tx-unicast-pkts": 12440,
|
||||
"rx-unicast-bytes": 1093407,
|
||||
"tx-unicast-bytes": 15083985,
|
||||
"rx-multicast-bytes": 20379
|
||||
},
|
||||
"ssid": "mainframe",
|
||||
"ip": "192.168.2.35",
|
||||
"hostname": "happle",
|
||||
"last-snr": 39,
|
||||
"last-rate-mbits": "24",
|
||||
"ap": 1,
|
||||
"mac": "20:c9:d0:cc:cc:cc",
|
||||
"radio": 2,
|
||||
"userinfo": {
|
||||
"name": "Holger",
|
||||
"visibility": "show",
|
||||
"ts": 1438474581580
|
||||
},
|
||||
"session-start": 1509211163,
|
||||
"last-rssi-dbm": -56,
|
||||
"last-activity": 1509211584
|
||||
},
|
||||
"38137": {
|
||||
"last-auth": 1509211199,
|
||||
"vlan": "FreiFunk",
|
||||
"stats": {
|
||||
"rx-multicast-pkts": 14,
|
||||
"rx-unicast-pkts": 931,
|
||||
"tx-unicast-pkts": 615,
|
||||
"rx-unicast-bytes": 70172,
|
||||
"tx-unicast-bytes": 265390,
|
||||
"rx-multicast-bytes": 1574
|
||||
},
|
||||
"ssid": "nordwest.freifunk.net",
|
||||
"ip": "10.18.159.6",
|
||||
"hostname": "iPhonevineSager",
|
||||
"last-snr": 13,
|
||||
"last-rate-mbits": "2",
|
||||
"ap": 1,
|
||||
"mac": "b8:53:ac:dd:dd:dd",
|
||||
"radio": 1,
|
||||
"userinfo": null,
|
||||
"session-start": 1509211199,
|
||||
"last-rssi-dbm": -82,
|
||||
"last-activity": 1509211584
|
||||
}
|
||||
}
|
||||
[
|
||||
{"ipv4": "192.168.2.127", "ipv6": [], "mac": "2c:0e:3d:aa:aa:aa", "ap": 2, "location": "Space"},
|
||||
{"ipv4": "192.168.2.179", "ipv6": ["6e7b:c7c6:9517:a9d0:958c:3939:c93e:9864", "e759:68b6:4c7d:8483:81b7:be87:119b:7ee1"], "mac": "10:68:3f:bb:bb:bb", "ap": 1, "location": "Radstelle"},
|
||||
{"ipv4": "192.168.2.35", "ipv6": [ "325c:7fa7:cc79:bcb7:a2b1:26f6:a4ef:2501" ], "mac": "20:c9:d0:cc:cc:cc", "ap": 1, "location": "Space"},
|
||||
{"ipv4": "10.18.159.6", "ipv6": [ ], "mac": "b8:53:ac:dd:dd:dd", "ap": 1, "location": ""}
|
||||
]
|
||||
`
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
masterDb := &masterDbTest{}
|
||||
@@ -128,19 +29,27 @@ func Test_parseWifiSessions(t *testing.T) {
|
||||
dd := DeviceData{masterDb: masterDb, userDb: userDb}
|
||||
|
||||
sessions, _, ok := dd.parseWifiSessions([]byte(testData))
|
||||
assert.Equal(len(sessions), 4)
|
||||
assert.Equal(4, len(sessions))
|
||||
assert.True(ok)
|
||||
|
||||
mustContain := [4]bool{false, false, false, false}
|
||||
for _, v := range sessions {
|
||||
mustContain[0] = mustContain[0] || (v.Ip == "192.168.2.127" && v.Mac == "2c:0e:3d:aa:aa:aa" && v.Vlan == "default" && v.AP == 2)
|
||||
mustContain[1] = mustContain[1] || (v.Ip == "192.168.2.179" && v.Mac == "10:68:3f:bb:bb:bb" && v.Vlan == "default" && v.AP == 1)
|
||||
mustContain[2] = mustContain[2] || (v.Ip == "192.168.2.35" && v.Mac == "20:c9:d0:cc:cc:cc" && v.Vlan == "default" && v.AP == 1)
|
||||
mustContain[3] = mustContain[3] || (v.Ip == "10.18.159.6" && v.Mac == "b8:53:ac:dd:dd:dd" && v.Vlan == "FreiFunk" && v.AP == 1)
|
||||
}
|
||||
for _, v := range mustContain {
|
||||
assert.True(v)
|
||||
}
|
||||
v := findByIp(assert, sessions, "192.168.2.127")
|
||||
assert.True(v.Mac == "2c:0e:3d:aa:aa:aa" && v.AP == 2 && v.Location == "Space")
|
||||
assert.Equal(0, len(v.Ipv6))
|
||||
|
||||
v = findByIp(assert, sessions, "192.168.2.179")
|
||||
assert.True(v.Mac == "10:68:3f:bb:bb:bb" && v.AP == 1 && v.Location == "Radstelle")
|
||||
assert.Equal(2, len(v.Ipv6))
|
||||
assert.Equal("6e7b:c7c6:9517:a9d0:958c:3939:c93e:9864", v.Ipv6[0])
|
||||
assert.Equal("e759:68b6:4c7d:8483:81b7:be87:119b:7ee1", v.Ipv6[1])
|
||||
|
||||
v = findByIp(assert, sessions, "192.168.2.35")
|
||||
assert.True(v.Mac == "20:c9:d0:cc:cc:cc" && v.AP == 1)
|
||||
assert.Equal(1, len(v.Ipv6))
|
||||
assert.Equal("325c:7fa7:cc79:bcb7:a2b1:26f6:a4ef:2501", v.Ipv6[0])
|
||||
|
||||
v = findByIp(assert, sessions, "10.18.159.6")
|
||||
assert.True(v.Mac == "b8:53:ac:dd:dd:dd" && v.AP == 1 && v.Location == "")
|
||||
assert.Equal(0, len(v.Ipv6))
|
||||
|
||||
// don't fail for garbage
|
||||
sessions, _, ok = dd.parseWifiSessions([]byte("{ totally invalid json }"))
|
||||
@@ -148,6 +57,17 @@ func Test_parseWifiSessions(t *testing.T) {
|
||||
assert.Equal(len(sessions), 0)
|
||||
}
|
||||
|
||||
func findByIp(assert *assert.Assertions, sessions []structs.WifiSession, ip string) *structs.WifiSession {
|
||||
for _, v := range sessions {
|
||||
if v.Ipv4 == ip {
|
||||
return &v
|
||||
}
|
||||
}
|
||||
|
||||
assert.Fail("IP not found", ip)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Test_peopleCalculation(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
masterMap := make(map[string]db.MasterDbEntry)
|
||||
@@ -206,7 +126,7 @@ func Test_peopleCalculation(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func assertPeopleAndDevices(assert *assert.Assertions, peopleArrayCount int, peopleCount uint, deviceCount uint, unknownDevicesCount uint, test PeopleAndDevices) {
|
||||
func assertPeopleAndDevices(assert *assert.Assertions, peopleArrayCount int, peopleCount uint16, deviceCount uint16, unknownDevicesCount uint16, test structs.PeopleAndDevices) {
|
||||
assert.Equal(peopleArrayCount, len(test.People), "len(People)")
|
||||
assert.Equal(peopleCount, test.PeopleCount, "peopleCount")
|
||||
assert.Equal(deviceCount, test.DeviceCount, "deviceCount")
|
||||
@@ -228,8 +148,9 @@ func Test_peopleNeverNil(t *testing.T) {
|
||||
/****************************************/
|
||||
|
||||
type sessionTestType struct {
|
||||
Vlan string `json:"vlan"`
|
||||
IP string `json:"ip"`
|
||||
Location string `Json:"location"`
|
||||
Ipv4 string `json:"ipv4"`
|
||||
Ipv6 []string `json:"ipv6"`
|
||||
Ap float64 `json:"ap"`
|
||||
Mac string `json:"mac"`
|
||||
}
|
||||
@@ -261,14 +182,14 @@ func (db *masterDbTest) Get(mac string) (db.MasterDbEntry, bool) {
|
||||
}
|
||||
|
||||
func stt(lastIp string, lastMac string) sessionTestType {
|
||||
return sessionTestType{"vlan", "10.1.1." + lastIp, 1, "00:00:00:00:00:" + lastMac}
|
||||
return sessionTestType{"Space", "10.1.1." + lastIp, make([]string, 0, 0),1, "00:00:00:00:00:" + lastMac}
|
||||
}
|
||||
|
||||
func newSessionTestData(testData ...sessionTestType) []byte {
|
||||
sessionData := make(map[string]sessionTestType)
|
||||
sessionData := make([]sessionTestType, 0)
|
||||
|
||||
for index, val := range testData {
|
||||
sessionData[strconv.Itoa(index)] = val
|
||||
for _, val := range testData {
|
||||
sessionData = append(sessionData, val)
|
||||
}
|
||||
|
||||
bytes, err := json.Marshal(sessionData)
|
||||
@@ -8,7 +8,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/eclipse/paho.mqtt.golang"
|
||||
"github.com/ktt-ol/spaceDevices/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/conf"
|
||||
"github.com/ktt-ol/spaceDevices/pkg/structs"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -46,7 +47,7 @@ func EnableMqttDebugLogging() {
|
||||
mqtt.DEBUG.SetOutput(stdLogWriter)
|
||||
}
|
||||
|
||||
func NewMqttHandler(conf conf.MqttConf) *MqttHandler {
|
||||
func NewMqttHandler(conf conf.MqttConf, clientOnly bool) *MqttHandler {
|
||||
opts := mqtt.NewClientOptions()
|
||||
|
||||
opts.AddBroker(conf.Url)
|
||||
@@ -65,21 +66,25 @@ func NewMqttHandler(conf conf.MqttConf) *MqttHandler {
|
||||
opts.SetTLSConfig(tlsConf)
|
||||
|
||||
opts.SetClientID(CLIENT_ID + GenerateRandomString(4))
|
||||
opts.SetAutoReconnect(true)
|
||||
opts.SetKeepAlive(10 * time.Second)
|
||||
opts.SetMaxReconnectInterval(5 * time.Minute)
|
||||
opts.SetWill(conf.DevicesTopic, emptyPeopleAndDevices(), 0, true)
|
||||
if !clientOnly {
|
||||
opts.SetAutoReconnect(true)
|
||||
opts.SetKeepAlive(10 * time.Second)
|
||||
opts.SetMaxReconnectInterval(5 * time.Minute)
|
||||
opts.SetWill(conf.DevicesTopic, emptyPeopleAndDevices(), 0, true)
|
||||
}
|
||||
|
||||
handler := MqttHandler{newDataChan: make(chan []byte), devicesTopic: conf.DevicesTopic, sessionTopic: conf.SessionTopic}
|
||||
opts.SetOnConnectHandler(handler.onConnect)
|
||||
opts.SetConnectionLostHandler(handler.onConnectionLost)
|
||||
if !clientOnly {
|
||||
opts.SetConnectionLostHandler(handler.onConnectionLost)
|
||||
}
|
||||
|
||||
handler.client = mqtt.NewClient(opts)
|
||||
if tok := handler.client.Connect(); tok.WaitTimeout(5*time.Second) && tok.Error() != nil {
|
||||
mqttLogger.WithError(tok.Error()).Fatal("Could not connect to mqtt server.")
|
||||
}
|
||||
|
||||
if conf.WatchDogTimeoutInMinutes > 0 {
|
||||
if !clientOnly && conf.WatchDogTimeoutInMinutes > 0 {
|
||||
mqttLogger.Println("Enable mqtt watch dog, timeout in minutes is", conf.WatchDogTimeoutInMinutes)
|
||||
handler.watchDog = NewWatchDog(time.Duration(conf.WatchDogTimeoutInMinutes) * time.Minute)
|
||||
}
|
||||
@@ -91,7 +96,7 @@ func (h *MqttHandler) GetNewDataChannel() chan []byte {
|
||||
return h.newDataChan
|
||||
}
|
||||
|
||||
func (h *MqttHandler) SendPeopleAndDevices(data PeopleAndDevices) {
|
||||
func (h *MqttHandler) SendPeopleAndDevices(data structs.PeopleAndDevices) {
|
||||
bytes, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
mqttLogger.Errorln("Invalid people json", err)
|
||||
@@ -119,6 +124,10 @@ func (h *MqttHandler) onConnect(client mqtt.Client) {
|
||||
h.watchDog.Ping()
|
||||
}
|
||||
|
||||
/*
|
||||
[{"ipv4": "192.99.99.99", "ipv6": "", "mac": "18:fe:ab:ab:ab:ab", "ap": 105, "location": "Space"} ]
|
||||
*/
|
||||
|
||||
/*
|
||||
mock := []byte(`{ "38134": {
|
||||
"last-auth": 1509211121,
|
||||
@@ -198,7 +207,7 @@ func defaultCertPool(certFile string) *x509.CertPool {
|
||||
}
|
||||
|
||||
func emptyPeopleAndDevices() string {
|
||||
pad := PeopleAndDevices{People: []Person{}}
|
||||
pad := structs.PeopleAndDevices{People: []structs.Person{}}
|
||||
bytes, err := json.Marshal(pad)
|
||||
if err != nil {
|
||||
mqttLogger.WithError(err).Panic()
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
|
||||
"github.com/gin-contrib/gzip"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/ktt-ol/spaceDevices/conf"
|
||||
"github.com/ktt-ol/spaceDevices/db"
|
||||
"github.com/ktt-ol/spaceDevices/mqtt"
|
||||
"github.com/ktt-ol/spaceDevices/internal/conf"
|
||||
"github.com/ktt-ol/spaceDevices/internal/db"
|
||||
"github.com/ktt-ol/spaceDevices/internal/mqtt"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package mqtt
|
||||
package structs
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type WifiSession struct {
|
||||
Ip string
|
||||
Mac string
|
||||
Vlan string
|
||||
AP int
|
||||
Ipv4 string
|
||||
Ipv6 []string
|
||||
Mac string
|
||||
AP int
|
||||
Location string
|
||||
}
|
||||
|
||||
type Devices struct {
|
||||
@@ -46,7 +46,7 @@
|
||||
<div class="alert alert-warning">
|
||||
Achtung, deine Mac Adresse wird zufällig generiert. Evt. ändert die sich bei jeder Verbindung.
|
||||
<br>
|
||||
Bei Windows 10 kann man das ändern, indem du das Netzwerk "Privat" und "Öffentlich" ist.
|
||||
Bei Windows 10 kann man das ändern, indem du das Netzwerk von "Öffentlich" auf "Privat" stellst.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user