@@ -50,26 +50,26 @@ func (s *Service) listenLoop() {
5050 if err != nil {
5151 return
5252 }
53- tcpAddress := conn . RemoteAddr ().( * net. TCPAddr )
54- ipString := tcpAddress . IP . String ( )
55- if s . ipAccessLists != nil &&
56- ! access . Check ( s .ipAccessLists , s . config . IPAccess . Mode , ipString ) {
57- conn . SetLinger ( 0 )
58- conn .Close ( )
59- s . logger . Warn (). Str ( "service" , s . config . Name ). Str ( "ip" , ipString ). Msg ( "Rejected by access control" )
60- continue
61- }
62- metadata := & adapter. Metadata {
63- ServiceName : s . config . Name ,
64- DestinationHostname : s .config .TargetAddress ,
65- DestinationPort : s .config .TargetPort ,
66- SourceAddress : netip . AddrPortFrom ( common . MustOK ( netip . AddrFromSlice ( tcpAddress . IP )). Unmap (), uint16 ( tcpAddress . Port )) ,
67- }
68- metadata . GenerateID ()
69- s . logger . Info (). Str ( "id" , metadata .ConnectionID ). Str ( "service" , s . config . Name ).
70- Str ("ip " , ipString ). Msg ( "New inbound connection" )
71- if s . legacyOutbound != nil {
72- go func () {
53+ go func () {
54+ tcpAddress := conn . RemoteAddr ().( * net. TCPAddr )
55+ ipString := tcpAddress . IP . String ()
56+ if s .ipAccessLists != nil &&
57+ ! access . Check ( s . ipAccessLists , s . config . IPAccess . Mode , ipString ) {
58+ conn .SetLinger ( 0 )
59+ conn . Close ( )
60+ s . logger . Warn (). Str ( "service" , s . config . Name ). Str ( "ip" , ipString ). Msg ( "Rejected by access control" )
61+ return
62+ }
63+ metadata := & adapter. Metadata {
64+ ServiceName : s .config .Name ,
65+ DestinationHostname : s .config .TargetAddress ,
66+ DestinationPort : s . config . TargetPort ,
67+ SourceAddress : netip . AddrPortFrom ( common . MustOK ( netip . AddrFromSlice ( tcpAddress . IP )). Unmap (), uint16 ( tcpAddress . Port )),
68+ }
69+ metadata .GenerateID ()
70+ s . logger . Info (). Str ("id " , metadata . ConnectionID ). Str ( "service" , s . config . Name ).
71+ Str ( "ip" , ipString ). Msg ( "New inbound connection" )
72+ if s . legacyOutbound != nil {
7373 defer s .logger .Info ().Str ("id" , metadata .ConnectionID ).Str ("service" , s .config .Name ).
7474 Str ("ip" , ipString ).Msg ("Disconnected" )
7575 defer conn .Close ()
@@ -89,10 +89,10 @@ func (s *Service) listenLoop() {
8989 Str ("player" , metadata .Minecraft .PlayerName ).Err (err ).Msg ("Handling Minecraft connection" )
9090 }
9191 }
92- }()
93- } else {
94- go s . router . HandleConnection ( conn , metadata )
95- }
92+ } else {
93+ s . router . HandleConnection ( conn , metadata )
94+ }
95+ }()
9696 }
9797}
9898
0 commit comments