Search in sources :

Example 1 with STREAM

use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.

the class ProxyFunctionsTest method shouldMatchInet6BeginExtensionSource.

@Test
public void shouldMatchInet6BeginExtensionSource() throws Exception {
    BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet6().source("fd12:3456:789a:1::1").build().build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet6(i -> i.protocol(p -> p.set(STREAM)).source(new UnsafeBuffer(fromHex("fd123456789a00010000000000000001")), 0, 16).destination(new UnsafeBuffer(fromHex("fd123456789a000100000000000000fe")), 0, 16).sourcePort(32768).destinationPort(443))).build();
    assertNotNull(matcher.match(byteBuf));
}
Also used : NONE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.NONE) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AUTHORITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.AUTHORITY) VERSION(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION) ByteBuffer(java.nio.ByteBuffer) ProxyInfoFW(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoFW) Assert.assertSame(org.junit.Assert.assertSame) ProxyBeginExFW(io.aklivity.zilla.specs.binding.proxy.internal.types.stream.ProxyBeginExFW) FunctionMapper(javax.el.FunctionMapper) BitUtil.fromHex(org.agrona.BitUtil.fromHex) Method(java.lang.reflect.Method) KEY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.KEY) NAMESPACE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.NAMESPACE) SECURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.SECURE) INET4(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET4) Assert.assertNotNull(org.junit.Assert.assertNotNull) INET6(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET6) CIPHER(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.CIPHER) Test(org.junit.Test) STREAM(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM) IDENTITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.IDENTITY) UnknownHostException(java.net.UnknownHostException) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ALPN(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.ALPN) NAME(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.NAME) INET(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET) UNIX(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.UNIX) ELContext(javax.el.ELContext) SIGNATURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE) Assert.assertEquals(org.junit.Assert.assertEquals) DirectBuffer(org.agrona.DirectBuffer) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 2 with STREAM

use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.

the class ProxyFunctionsTest method shouldNotMatchInetBeginExtensionDestinationPort.

@Test(expected = Exception.class)
public void shouldNotMatchInetBeginExtensionDestinationPort() throws Exception {
    BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet().destinationPort(444).build().build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet(i -> i.protocol(p -> p.set(STREAM)).source("*").destination("example.com").sourcePort(32768).destinationPort(443))).build();
    assertNull(matcher.match(byteBuf));
}
Also used : NONE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.NONE) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AUTHORITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.AUTHORITY) VERSION(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION) ByteBuffer(java.nio.ByteBuffer) ProxyInfoFW(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoFW) Assert.assertSame(org.junit.Assert.assertSame) ProxyBeginExFW(io.aklivity.zilla.specs.binding.proxy.internal.types.stream.ProxyBeginExFW) FunctionMapper(javax.el.FunctionMapper) BitUtil.fromHex(org.agrona.BitUtil.fromHex) Method(java.lang.reflect.Method) KEY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.KEY) NAMESPACE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.NAMESPACE) SECURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.SECURE) INET4(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET4) Assert.assertNotNull(org.junit.Assert.assertNotNull) INET6(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET6) CIPHER(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.CIPHER) Test(org.junit.Test) STREAM(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM) IDENTITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.IDENTITY) UnknownHostException(java.net.UnknownHostException) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ALPN(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.ALPN) NAME(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.NAME) INET(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET) UNIX(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.UNIX) ELContext(javax.el.ELContext) SIGNATURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE) Assert.assertEquals(org.junit.Assert.assertEquals) DirectBuffer(org.agrona.DirectBuffer) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 3 with STREAM

use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.

the class ProxyFunctionsTest method shouldMatchInetBeginExtensionProtocol.

@Test
public void shouldMatchInetBeginExtensionProtocol() throws Exception {
    BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet().protocol("stream").build().build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet(i -> i.protocol(p -> p.set(STREAM)).source("*").destination("example.com").sourcePort(32768).destinationPort(443))).build();
    assertNotNull(matcher.match(byteBuf));
}
Also used : NONE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.NONE) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AUTHORITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.AUTHORITY) VERSION(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION) ByteBuffer(java.nio.ByteBuffer) ProxyInfoFW(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoFW) Assert.assertSame(org.junit.Assert.assertSame) ProxyBeginExFW(io.aklivity.zilla.specs.binding.proxy.internal.types.stream.ProxyBeginExFW) FunctionMapper(javax.el.FunctionMapper) BitUtil.fromHex(org.agrona.BitUtil.fromHex) Method(java.lang.reflect.Method) KEY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.KEY) NAMESPACE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.NAMESPACE) SECURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.SECURE) INET4(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET4) Assert.assertNotNull(org.junit.Assert.assertNotNull) INET6(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET6) CIPHER(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.CIPHER) Test(org.junit.Test) STREAM(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM) IDENTITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.IDENTITY) UnknownHostException(java.net.UnknownHostException) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ALPN(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.ALPN) NAME(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.NAME) INET(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET) UNIX(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.UNIX) ELContext(javax.el.ELContext) SIGNATURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE) Assert.assertEquals(org.junit.Assert.assertEquals) DirectBuffer(org.agrona.DirectBuffer) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 4 with STREAM

use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.

the class ProxyFunctionsTest method shouldNotMatchInetBeginExtensionProtocol.

@Test(expected = Exception.class)
public void shouldNotMatchInetBeginExtensionProtocol() throws Exception {
    BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet().protocol("datagram").build().build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet(i -> i.protocol(p -> p.set(STREAM)).source("*").destination("example.com").sourcePort(32768).destinationPort(443))).build();
    assertNull(matcher.match(byteBuf));
}
Also used : NONE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.NONE) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AUTHORITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.AUTHORITY) VERSION(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION) ByteBuffer(java.nio.ByteBuffer) ProxyInfoFW(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoFW) Assert.assertSame(org.junit.Assert.assertSame) ProxyBeginExFW(io.aklivity.zilla.specs.binding.proxy.internal.types.stream.ProxyBeginExFW) FunctionMapper(javax.el.FunctionMapper) BitUtil.fromHex(org.agrona.BitUtil.fromHex) Method(java.lang.reflect.Method) KEY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.KEY) NAMESPACE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.NAMESPACE) SECURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.SECURE) INET4(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET4) Assert.assertNotNull(org.junit.Assert.assertNotNull) INET6(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET6) CIPHER(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.CIPHER) Test(org.junit.Test) STREAM(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM) IDENTITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.IDENTITY) UnknownHostException(java.net.UnknownHostException) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ALPN(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.ALPN) NAME(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.NAME) INET(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET) UNIX(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.UNIX) ELContext(javax.el.ELContext) SIGNATURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE) Assert.assertEquals(org.junit.Assert.assertEquals) DirectBuffer(org.agrona.DirectBuffer) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 5 with STREAM

use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.

the class ProxyFunctionsTest method shouldMatchUnixBeginExtensionDestination.

@Test
public void shouldMatchUnixBeginExtensionDestination() throws Exception {
    BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressUnix().destination("destination-5678").build().build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.unix(i -> i.protocol(p -> p.set(STREAM)).source(paddedUtf8("source-1234", 108), 0, 108).destination(paddedUtf8("destination-5678", 108), 0, 108))).build();
    assertNotNull(matcher.match(byteBuf));
}
Also used : NONE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.NONE) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AUTHORITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.AUTHORITY) VERSION(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION) ByteBuffer(java.nio.ByteBuffer) ProxyInfoFW(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoFW) Assert.assertSame(org.junit.Assert.assertSame) ProxyBeginExFW(io.aklivity.zilla.specs.binding.proxy.internal.types.stream.ProxyBeginExFW) FunctionMapper(javax.el.FunctionMapper) BitUtil.fromHex(org.agrona.BitUtil.fromHex) Method(java.lang.reflect.Method) KEY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.KEY) NAMESPACE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.NAMESPACE) SECURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.SECURE) INET4(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET4) Assert.assertNotNull(org.junit.Assert.assertNotNull) INET6(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET6) CIPHER(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.CIPHER) Test(org.junit.Test) STREAM(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM) IDENTITY(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.IDENTITY) UnknownHostException(java.net.UnknownHostException) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ALPN(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.ALPN) NAME(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.NAME) INET(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET) UNIX(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.UNIX) ELContext(javax.el.ELContext) SIGNATURE(io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE) Assert.assertEquals(org.junit.Assert.assertEquals) DirectBuffer(org.agrona.DirectBuffer) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Aggregations

INET (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET)59 INET4 (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET4)59 INET6 (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.INET6)59 NONE (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.NONE)59 UNIX (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressFamily.UNIX)59 STREAM (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM)59 ProxyInfoFW (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoFW)59 ALPN (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.ALPN)59 AUTHORITY (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.AUTHORITY)59 IDENTITY (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.IDENTITY)59 NAMESPACE (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.NAMESPACE)59 SECURE (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyInfoType.SECURE)59 CIPHER (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.CIPHER)59 KEY (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.KEY)59 NAME (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.NAME)59 SIGNATURE (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.SIGNATURE)59 VERSION (io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION)59 ProxyBeginExFW (io.aklivity.zilla.specs.binding.proxy.internal.types.stream.ProxyBeginExFW)59 Method (java.lang.reflect.Method)59 UnknownHostException (java.net.UnknownHostException)59