mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Allow localhost to not be defined, only need 127.0.0.1
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -1031,7 +1031,7 @@ func lexFloat(lx *lexer) stateFn {
|
||||
// lexIPAddr consumes IP addrs, like 127.0.0.1:4222
|
||||
func lexIPAddr(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
if unicode.IsDigit(r) || r == '.' || r == ':' {
|
||||
if unicode.IsDigit(r) || r == '.' || r == ':' || r == '-' {
|
||||
return lexIPAddr
|
||||
}
|
||||
lx.backup()
|
||||
|
||||
@@ -955,6 +955,30 @@ func TestUnquotedIPAddr(t *testing.T) {
|
||||
lx = lex("listen: apcera.me:80")
|
||||
expect(t, lx, expectedItems)
|
||||
|
||||
expectedItems = []item{
|
||||
{itemKey, "listen", 1},
|
||||
{itemString, "nats.io:-1", 1},
|
||||
{itemEOF, "", 1},
|
||||
}
|
||||
lx = lex("listen: nats.io:-1")
|
||||
expect(t, lx, expectedItems)
|
||||
|
||||
expectedItems = []item{
|
||||
{itemKey, "listen", 1},
|
||||
{itemInteger, "-1", 1},
|
||||
{itemEOF, "", 1},
|
||||
}
|
||||
lx = lex("listen: -1")
|
||||
expect(t, lx, expectedItems)
|
||||
|
||||
expectedItems = []item{
|
||||
{itemKey, "listen", 1},
|
||||
{itemString, ":-1", 1},
|
||||
{itemEOF, "", 1},
|
||||
}
|
||||
lx = lex("listen: :-1")
|
||||
expect(t, lx, expectedItems)
|
||||
|
||||
expectedItems = []item{
|
||||
{itemKey, "listen", 1},
|
||||
{itemString, ":80", 1},
|
||||
|
||||
Reference in New Issue
Block a user