# Cluster definition
cluster {
listen: localhost:4244 # host/port for inbound route connections
# Authorization for route connections
authorization {
user: route_user
# ./util/mkpasswd -p T0pS3cr3tT00!
password: $2a$11$xH8dkGrty1cBNtZjhPeWJewu/YPbSU.rXJWmS6SFilOBXzmZoMk9m
timeout: 0.5
}
# Routes are actively solicited and connected to from this server.
# Other servers can connect to us if they supply the correct credentials
# in their routes definitions from above.
routes = [
nats-route://user1:pass1@127.0.0.1:4245
nats-route://user2:pass2@127.0.0.1:4246
]
}
1012 // processMsg is called to process an inbound msg from a client.
1013 func (c *client) processMsg(msg []byte) {
...
1146 for _, sub := range r.psubs {
1147 // Check if this is a send to a ROUTER, make sure we only send it
1148 // once. The other side will handle the appropriate re-processing
1149 // and fan-out. Also enforce 1-Hop semantics, so no routing to another.
1150 if sub.client.typ == ROUTER { ...
1176 mh := c.msgHeader(msgh[:si], sub)
1177 c.deliverMsg(sub, mh, msg)