commit
c55257cbed
@ -1,5 +1,5 @@
|
||||
FROM golang:1.11
|
||||
WORKDIR /go/src/gosrc.io/xmpp
|
||||
WORKDIR /xmpp
|
||||
RUN curl -o codecov.sh -s https://codecov.io/bash && chmod +x codecov.sh
|
||||
COPY . ./
|
||||
RUN go get -t ./...
|
||||
# RUN go get -t ./...
|
||||
|
@ -0,0 +1,28 @@
|
||||
# XMPP Check
|
||||
|
||||
XMPP check is a tool to check TLS certificate on a remote server.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ go get -u gosrc.io/xmpp/cmd/xmpp-check
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
If you server is on standard port and XMPP domains matches the hostname you can simply use:
|
||||
|
||||
```
|
||||
$ xmpp-check myhost.net
|
||||
2019/05/16 16:04:36 All checks passed
|
||||
```
|
||||
|
||||
You can also pass the port and the XMPP domain if different from the server hostname:
|
||||
|
||||
```
|
||||
$ xmpp-check myhost.net:5222 xmppdomain.net
|
||||
2019/05/16 16:05:21 All checks passed
|
||||
```
|
||||
|
||||
Error code will be non-zero in case of error. You can thus use it directly with your usual
|
||||
monitoring scripts.
|
@ -0,0 +1,29 @@
|
||||
package xmpp_test
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
// Compare iq structure but ignore empty namespace as they are set properly on
|
||||
// marshal / unmarshal. There is no need to manage them on the manually
|
||||
// crafted structure.
|
||||
func xmlEqual(x, y interface{}) bool {
|
||||
alwaysEqual := cmp.Comparer(func(_, _ interface{}) bool { return true })
|
||||
opts := cmp.Options{
|
||||
cmp.FilterValues(func(x, y interface{}) bool {
|
||||
xx, xok := x.(xml.Name)
|
||||
yy, yok := y.(xml.Name)
|
||||
if xok && yok {
|
||||
zero := xml.Name{}
|
||||
if xx == zero || yy == zero {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}, alwaysEqual),
|
||||
}
|
||||
|
||||
return cmp.Equal(x, y, opts)
|
||||
}
|
Loading…
Reference in new issue