Skip to content

Client IP #12

@bublikOff

Description

@bublikOff

In some cases it may usable to have client ip

Add to SocketWrapper

    public EndPoint RemoteEndPoint
    {
        get
        {
            return _socket.RemoteEndPoint;
        }
    }

    public EndPoint LocalEndPoint
    {
        get
        {
            return _socket.LocalEndPoint;
        }
    }

Change Go in Connection

                frame = _frame = new Frame(

                new FrameContext
                {
                    Services = _services,
                    App = _app,
                    Write = _socketSender.Write,
                    Flush = _socketSender.Flush,
                    End = ProduceEnd
                },

                ((SocketWrapper)_socket).LocalEndPoint,
                ((SocketWrapper)_socket).RemoteEndPoint

                );

Finally in Frame

    private readonly EndPoint _localEndPoint;
    private readonly EndPoint _remoteEndPoint;

    public Frame(FrameContext context, EndPoint localEndPoint, EndPoint remoteEndPoint)
    {
        _context = context;

        _localEndPoint = localEndPoint;
        _remoteEndPoint = remoteEndPoint;

    }

    private IDictionary<string, object> CreateOwinEnvironment()
    {
         ....
        env["owin.ServerAddress"] = _localEndPoint;
        env["owin.RemoteAddress"] = _remoteEndPoint;
         ....
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions