skycoin / dmsg

dmsg
7 stars 17 forks source link

proxy configuration for `dmsgip` #285

Open 0pcom opened 2 months ago

0pcom commented 2 months ago

I've implemented the proxy configuration for dmsgip which is included in examples/proxified of this repo

However, on testing, the real ip address of the dmsg client was returned instead of the ip address of the proxy connection.

I believe currently, only the request to dmsg discovery traverses the proxy connection, while the connection to the dmsg server itself goes outside the proxy.

0pcom commented 2 months ago

I have it working now ; demonstrated with the skywire socks5 proxy

$ go run cmd/dmsg/dmsg.go ip --loglvl debug -d 0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7 -p 127.0.0.1:1080
[2024-09-15T12:35:49.111920002-05:00] DEBUG disc.NewHTTP [dmsgip]: Created HTTP client. addr="http://dmsgd.skywire.skycoin.com"
[2024-09-15T12:35:49.111974078-05:00] DEBUG [dmsgip]: Connecting to dmsg network... dmsg_disc="http://dmsgd.skywire.skycoin.com" public_key="0284d65ee3142fed24ec08fb6f23defdde4198fc6e4956b3c7d5863d57eeae7588"
[2024-09-15T12:35:49.112051037-05:00] DEBUG [dmsg_client]: Discovering dmsg servers...
[2024-09-15T12:35:49.831005926-05:00] DEBUG [dmsg_client]: Dialing session... remote_pk=03d5b55d1133b26485c664cf8b95cff6746d1e321c34e48c9fed293eff0d6d49e5
[2024-09-15T12:35:51.128346762-05:00] DEBUG [dmsgip]: Dmsg network ready.
[2024-09-15T12:35:51.128371417-05:00] DEBUG [dmsg_client]: Serving session. remote_pk=03d5b55d1133b26485c664cf8b95cff6746d1e321c34e48c9fed293eff0d6d49e5
[2024-09-15T12:35:51.826225426-05:00] DEBUG [dmsg_client]: Dialing session... remote_pk=0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7
[2024-09-15T12:35:53.019802044-05:00] DEBUG [dmsg_client]: Updating entry. entry=   version: 0.0.1
    sequence: 0
    registered at: 1726421750834066563
    static public key: 0284d65ee3142fed24ec08fb6f23defdde4198fc6e4956b3c7d5863d57eeae7588
    signature: 24ddd478498bcd42cd855074b9a7e887d556bfe7fa571d345000730883454cef011ba0145b6e745cf87dee43603aa0786f8e1d6318b046cffca0341be5975aec01
    entry is registered as client. Related info: 
        delegated servers: 
            03d5b55d1133b26485c664cf8b95cff6746d1e321c34e48c9fed293eff0d6d49e5
            0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7

[2024-09-15T12:35:53.304226546-05:00] DEBUG [dmsg_client]: Serving session. remote_pk=0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7
143.42.59.213

[2024-09-15T12:35:54.927054239-05:00] DEBUG [dmsg_client]: Stopped accepting streams. error="session shutdown" session=0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7
[2024-09-15T12:35:54.927120312-05:00] DEBUG [dmsg_client]: Stopped serving client!
[2024-09-15T12:35:54.927144201-05:00] DEBUG [dmsg_client]: Stopped accepting streams. error="session shutdown" session=03d5b55d1133b26485c664cf8b95cff6746d1e321c34e48c9fed293eff0d6d49e5
[2024-09-15T12:35:54.927151403-05:00] DEBUG [dmsg_client]: Session closed. error=<nil>
[2024-09-15T12:35:54.927178458-05:00] DEBUG [dmsg_client]: Session closed. error=<nil>
[2024-09-15T12:35:54.92719034-05:00] DEBUG [dmsg_client]: All sessions closed.
[2024-09-15T12:35:55.627310952-05:00] DEBUG [dmsg_client]: Deleting entry. entry=   version: 0.0.1
    sequence: 1
    registered at: 1726421753019887184
    static public key: 0284d65ee3142fed24ec08fb6f23defdde4198fc6e4956b3c7d5863d57eeae7588
    signature: 7c4aa6640c918f48d3cd09518ae1dda87515745bad77eaca6c96816e2e29a549078c00cb67e39414c6705cf9105882a3bcdb47d60c57014f7436165f4f9fdda701
    entry is registered as client. Related info: 
        delegated servers: 
            03d5b55d1133b26485c664cf8b95cff6746d1e321c34e48c9fed293eff0d6d49e5
            0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7

[2024-09-15T12:35:55.914297345-05:00] DEBUG [dmsg_client]: Entry Deleted successfully.
[2024-09-15T12:35:55.914376433-05:00] DEBUG [dmsgip]: Disconnected from dmsg network. error=<nil>