Add a prefix of 127.0.0.1 to address if only port is specified #43

Closed
notplants wants to merge 1 commits from debug into keypaths
Owner
No description provided.
notplants added 4 commits 2022-05-26 21:12:21 +00:00
Author
Owner

For some reason, go-sbot was not accepting connections when the address was specified in config.toml as:
lis = "127.0.0.1:8008" (version A)

However, if we specified the address in config.toml as:
lis = ":8008" (version B)

then go-sbot would happily accept connections, invites and sync with peers :-)

However, if we specified the address as so, then golgi stopped being able to communicate with go-sbot for some reason.

So it was a sort of catch22, which took me a while to pin down exactly, where in version A go-sbot can talk to peers, and in version B golgi can talk to go-sbot.

I'm not sure why this is the case, but empirically this is what I found.

In this PR, I make it so that if golgi finds that a configured address starts with :, then it prefixes it with 127.0.0.1.

This is tested and now if we specify the address with version A in config.toml, then both things are working.

For some reason, go-sbot was not accepting connections when the address was specified in config.toml as: lis = "127.0.0.1:8008" (version A) However, if we specified the address in config.toml as: lis = ":8008" (version B) then go-sbot would happily accept connections, invites and sync with peers :-) However, if we specified the address as so, then golgi stopped being able to communicate with go-sbot for some reason. So it was a sort of catch22, which took me a while to pin down exactly, where in version A go-sbot can talk to peers, and in version B golgi can talk to go-sbot. I'm not sure why this is the case, but empirically this is what I found. In this PR, I make it so that if golgi finds that a configured address starts with :, then it prefixes it with 127.0.0.1. This is tested and now if we specify the address with version A in config.toml, then both things are working.
notplants requested review from glyph 2022-05-26 21:16:04 +00:00
Owner

@notplants

The behaviour of version B matches the example given in the go-sbot config example: 27a936da80/docs/config.md

I suspect version A would have worked if you used localhost instead of 127.0.0.1. That's the approach I was using when testing PeachPub.

I wonder if it's better to prefix localhost or 127.0.0.1, and what the difference might be?

Here's how I handle the lis config value for display in the web interface sbot settings page: https://git.coopcloud.tech/PeachCloud/peach-workspace/src/branch/main/peach-web/src/routes/settings/scuttlebutt/configure.rs#L36

@notplants The behaviour of version B matches the example given in the go-sbot config example: https://github.com/cryptoscope/ssb/blob/27a936da805d127f22af539760849e03f07358e6/docs/config.md I suspect version A would have worked if you used `localhost` instead of `127.0.0.1`. That's the approach I was using when testing PeachPub. I wonder if it's better to prefix `localhost` or `127.0.0.1`, and what the difference might be? Here's how I handle the `lis` config value for display in the web interface sbot settings page: https://git.coopcloud.tech/PeachCloud/peach-workspace/src/branch/main/peach-web/src/routes/settings/scuttlebutt/configure.rs#L36
notplants added 1 commit 2022-06-15 10:12:59 +00:00
Author
Owner

Interesting question, I hadn't looked this up before either. According to this post and this post localhost is usually just a local domain which is mapped to the IP address 127.0.0.1 which is the "self" ip address. The first post also says that using 127.0.0.1 is faster than localhost because it doesn't require a lookup of the IP address from the domain (although I guess this difference is negligible).

Interesting question, I hadn't looked this up before either. According to [this post](https://www.tutorialspoint.com/difference-between-localhost-and-127-0-0-1) and [this post](https://www.quora.com/Is-there-any-difference-between-localhost-and-127-0-0-1?share=1) localhost is usually just a local domain which is mapped to the IP address 127.0.0.1 which is the "self" ip address. The first post also says that using 127.0.0.1 is faster than localhost because it doesn't require a lookup of the IP address from the domain (although I guess this difference is negligible).
notplants closed this pull request 2022-06-15 10:27:30 +00:00
Author
Owner

All these committs were merged via this PR #41, so I am closing this branch.

All these committs were merged via this PR https://git.coopcloud.tech/golgi-ssb/golgi/pulls/41, so I am closing this branch.

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: golgi-ssb/golgi#43
No description provided.